Roo/Resizable.js
[roojs1] / Roo / Resizable.js
index a5e45c3..784e27c 100644 (file)
@@ -28,6 +28,7 @@ Value   Description
  'sw'    southwest
  'se'    southeast
  'ne'    northeast
+ 'hd'    horizontal drag
  'all'   all
 </pre>
  * <p>Here's an example showing the creation of a typical Resizable:</p>
@@ -162,6 +163,8 @@ Roo.Resizable = function(el, config)
     }
 
     if(this.draggable){
+        Roo.log('in11?');
+        Roo.log(this.resizeChild );
         this.dd = this.dynamic ?
             this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
         this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
@@ -308,7 +311,9 @@ Roo.extend(Roo.Resizable, Roo.util.Observable, {
 
     // private
     updateChildSize : function(){
+        
         if(this.resizeChild){
+            Roo.log('in?');
             var el = this.el;
             var child = this.resizeChild;
             var adj = this.adjustments;
@@ -419,8 +424,19 @@ Roo.extend(Roo.Resizable, Roo.util.Observable, {
                     h -= diffY;
                     break;
                 case "hdrag":
+                    
+                    if (wi) {
+                        var adiffX = Math.abs(diffX);
+                        var sub = (adiffX % wi); // how much 
+                        if (sub > (wi/2)) { // far enough to snap
+                            diffX = (diffX > 0) ? diffX-sub + wi : diffX+sub - wi;
+                        } else {
+                            // remove difference.. 
+                            diffX = (diffX > 0) ? diffX-sub : diffX+sub;
+                        }
+                    }
                     x += diffX;
-                    w -= diffX;
+                    x = Math.max(this.minX, x);
                     break;
                 case "west":
                     diffX = this.constrain(w, diffX, mw, mxw);
@@ -464,7 +480,6 @@ Roo.extend(Roo.Resizable, Roo.util.Observable, {
                     case "southwest":
                         x -= sw - w;
                     break;
-                    case "hdrag":
                     case "west":
                         x -= sw - w;
                         break;
@@ -570,7 +585,10 @@ Roo.extend(Roo.Resizable, Roo.util.Observable, {
     getResizeChild : function(){
         return this.resizeChild;
     },
-
+    groupHandler : function()
+    {
+        
+    },
     /**
      * Destroys this resizable. If the element was wrapped and
      * removeEl is not true then the element remains.