Roo/form/ComboBoxArray.js
[roojs1] / Roo / Resizable.js
index da75e56..4502fe6 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>
@@ -419,9 +420,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;
                     x = Math.max(this.minX, x);
-                    w -= diffX;
                     break;
                 case "west":
                     diffX = this.constrain(w, diffX, mw, mxw);
@@ -465,7 +476,6 @@ Roo.extend(Roo.Resizable, Roo.util.Observable, {
                     case "southwest":
                         x -= sw - w;
                     break;
-                    case "hdrag":
                     case "west":
                         x -= sw - w;
                         break;