src/Builder4/ClutterFiles.bjs
authorAlan Knowles <alan@roojs.com>
Sun, 24 May 2015 08:59:30 +0000 (16:59 +0800)
committerAlan Knowles <alan@roojs.com>
Sun, 24 May 2015 08:59:30 +0000 (16:59 +0800)
src/Builder4/ClutterFiles.vala

src/Builder4/ClutterFiles.bjs
src/Builder4/ClutterFiles.vala

index ce2a999..2a55959 100644 (file)
@@ -66,7 +66,7 @@
     },
     {
      "listeners" : {
-      "scroll_event" : "( event) => {\n   //Sprint(\"scroll event\");\n            var y = _this.filelayout.el.y;\n            var dir = event.direction;\n            switch (dir) {\n                case Clutter.ScrollDirection.UP:\n                    y += event.y /2;\n                    break;\n                case Clutter.ScrollDirection.DOWN:\n                    y -= event.y /2 ;\n                    break;\n                default:\n                    return false;\n            }\n            // range of scroll -- can go up -- eg.. -ve value.\n            \n            y = float.min(0, y);\n            \n            // to work out the max -ve number\n            // height of filelayout\n            // height of scrollactor..\n            \n            var last_child_bottom = _this.filelayout.el.last_child.y +  _this.filelayout.el.last_child.height;\n             if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {\n                return  false;\n            }\n        \n        \n            \n            \n        //    print(\"\\nlast child - this height = %f  ==== new y %f\\n \".printf( \n          //          last_child_bottom - this.el.height,\n           //         y));    \n           // y = float.min(0, y);    //??\n           // print(\"scroll event of %f  - new y = %f \".printf(event.y, y));\n            _this.filelayout.el.y = y;\n            return true;\n          \n}"
+      "scroll_event" : "( event) => {\n   //Sprint(\"scroll event\");\n    var y = _this.filelayout.el.y;\n    var dir = event.direction;\n    switch (dir) {\n        case Clutter.ScrollDirection.UP:\n            y += event.y /2;\n            break;\n        case Clutter.ScrollDirection.DOWN:\n            y -= event.y /2 ;\n            break;\n        default:\n            return false;\n    }\n    // range of scroll -- can go up -- eg.. -ve value.\n    \n    y = float.min(0, y);\n    \n    // to work out the max -ve number\n    // height of filelayout\n    // height of scrollactor..\n    \n    var last_child_bottom = _this.filelayout.el.last_child.y +  _this.filelayout.el.last_child.height;\n    if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {\n        return  false;\n    }\n\n\n    \n    \n//    print(\"\\nlast child - this height = %f  ==== new y %f\\n \".printf( \n  //          last_child_bottom - this.el.height,\n   //         y));    \n   // y = float.min(0, y);    //??\n   // print(\"scroll event of %f  - new y = %f \".printf(event.y, y));\n   print(\"Set scroll to %f (lcb=%f)\", y, last_child_bottom);\n   \n    _this.filelayout.el.y = y;\n    return true;\n          \n}"
      },
      "# Gee.ArrayList<Xcls_fileitem> fileitems" : "new Gee.ArrayList<Xcls_fileitem>()",
      "id" : "scroller",
index ead2c1a..0a1bd25 100644 (file)
@@ -335,41 +335,43 @@ public class Xcls_ClutterFiles : Object
             //listeners
             this.el.scroll_event.connect( ( event) => {
                //Sprint("scroll event");
-                        var y = _this.filelayout.el.y;
-                        var dir = event.direction;
-                        switch (dir) {
-                            case Clutter.ScrollDirection.UP:
-                                y += event.y /2;
-                                break;
-                            case Clutter.ScrollDirection.DOWN:
-                                y -= event.y /2 ;
-                                break;
-                            default:
-                                return false;
-                        }
-                        // range of scroll -- can go up -- eg.. -ve value.
-                        
-                        y = float.min(0, y);
-                        
-                        // to work out the max -ve number
-                        // height of filelayout
-                        // height of scrollactor..
-                        
-                        var last_child_bottom = _this.filelayout.el.last_child.y +  _this.filelayout.el.last_child.height;
-                         if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {
-                            return  false;
-                        }
-                    
-                    
-                        
-                        
-                    //    print("\nlast child - this height = %f  ==== new y %f\n ".printf( 
-                      //          last_child_bottom - this.el.height,
-                       //         y));    
-                       // y = float.min(0, y);    //??
-                       // print("scroll event of %f  - new y = %f ".printf(event.y, y));
-                        _this.filelayout.el.y = y;
-                        return true;
+                var y = _this.filelayout.el.y;
+                var dir = event.direction;
+                switch (dir) {
+                    case Clutter.ScrollDirection.UP:
+                        y += event.y /2;
+                        break;
+                    case Clutter.ScrollDirection.DOWN:
+                        y -= event.y /2 ;
+                        break;
+                    default:
+                        return false;
+                }
+                // range of scroll -- can go up -- eg.. -ve value.
+                
+                y = float.min(0, y);
+                
+                // to work out the max -ve number
+                // height of filelayout
+                // height of scrollactor..
+                
+                var last_child_bottom = _this.filelayout.el.last_child.y +  _this.filelayout.el.last_child.height;
+                if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {
+                    return  false;
+                }
+            
+            
+                
+                
+            //    print("\nlast child - this height = %f  ==== new y %f\n ".printf( 
+              //          last_child_bottom - this.el.height,
+               //         y));    
+               // y = float.min(0, y);    //??
+               // print("scroll event of %f  - new y = %f ".printf(event.y, y));
+               print("Set scroll to %f (lcb=%f)", y, last_child_bottom);
+               
+                _this.filelayout.el.y = y;
+                return true;
                       
             });
         }