},
{
"listeners" : {
- "scroll_event" : "( event) => {\n print(\"scroll event\\n\");\n var y = _this.filelayout.el.y;\n var dir = event.direction;\n \n var last_child_bottom = _this.filelayout.el.last_child.y + _this.filelayout.el.last_child.height;\n var bottompos = -1 * ( last_child_bottom - (0.5f * this.el.height));\n \n switch (dir) {\n case Clutter.ScrollDirection.UP:\n print(\"Scroll up by %f\\n\", event.y);\n y += event.y /2;\n y = float.min(0, y); // \n break;\n \n case Clutter.ScrollDirection.DOWN:\n print(\"Scroll down by %f\\n\", event.y);\n y -= event.y /2 ;\n y = float.max(bottompos, y);\n \n \n break;\n \t case Clutter.ScrollDirection.SMOOTH:\n \t double delta_x, delta_y;\n \t event.get_scroll_delta(out delta_x, out delta_y);\n //print(\"Scroll SMOOTH? by %f\\n\", delta_y * event.y);\n y += (delta_y * event.y) /2 ;\n y = float.max(bottompos, y);\n \n break;\n default:\n\t print(\"scroll event = bad direction %s\\n\", dir.to_string());\n return false;\n }\n // range of scroll -- can go up -- eg.. -ve value.\n \n\n \n print(\"Set scroll to %f (lcb=%f / height = %f)\\n\", y, last_child_bottom, this.el.height);\n \n _this.filelayout.el.y = y;\n return true;\n \n}"
+ "scroll_event" : "( event) => {\n print(\"scroll event\\n\");\n var y = _this.filelayout.el.y;\n var dir = event.direction;\n \n var last_child_bottom = _this.filelayout.el.last_child.y + _this.filelayout.el.last_child.height;\n var bottompos = -1 * ( last_child_bottom - (0.5f * this.el.height));\n \n switch (dir) {\n case Clutter.ScrollDirection.UP:\n print(\"Scroll up by %f\\n\", event.y);\n y += event.y /2;\n y = float.min(0, y); // \n break;\n \n case Clutter.ScrollDirection.DOWN:\n print(\"Scroll down by %f\\n\", event.y);\n y -= event.y /2 ;\n y = float.max(bottompos, y);\n \n \n break;\n \t case Clutter.ScrollDirection.SMOOTH:\n \t double delta_x, delta_y;\n \t event.get_scroll_delta(out delta_x, out delta_y);\n //print(\"Scroll SMOOTH? by %f\\n\", delta_y * event.y);\n y += ((float)delta_y * event.y * -1.0f) /2 ;\n y = float.max(bottompos, y);\n y = float.min(0, y); // \n \n break;\n default:\n\t print(\"scroll event = bad direction %s\\n\", dir.to_string());\n return false;\n }\n // range of scroll -- can go up -- eg.. -ve value.\n \n\n \n print(\"Set scroll to %f (lcb=%f / height = %f)\\n\", y, last_child_bottom, this.el.height);\n \n _this.filelayout.el.y = y;\n return true;\n \n}"
},
"# Gee.ArrayList<Xcls_fileitem> fileitems" : "new Gee.ArrayList<Xcls_fileitem>()",
"id" : "scroller",
double delta_x, delta_y;
event.get_scroll_delta(out delta_x, out delta_y);
//print("Scroll SMOOTH? by %f\n", delta_y * event.y);
- y += (delta_y * event.y) /2 ;
+ y += ((float)delta_y * event.y * -1.0f) /2 ;
y = float.max(bottompos, y);
+ y = float.min(0, y); //
break;
default: