X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/source/ResizeTracker.html diff --git a/docs/source/ResizeTracker.html b/docs/source/ResizeTracker.html index c9ea48ae..4bff3ecc 100644 --- a/docs/source/ResizeTracker.html +++ b/docs/source/ResizeTracker.html @@ -1,6 +1,25 @@ -
/**
+
+
+
+
+ The source code
+
+
+
+
+
+
+ /**
* @class Ext.resizer.ResizeTracker
* @extends Ext.dd.DragTracker
+ * Private utility class for Ext.resizer.Resizer.
+ * @private
*/
Ext.define('Ext.resizer.ResizeTracker', {
extend: 'Ext.dd.DragTracker',
@@ -59,7 +78,7 @@ Ext.define('Ext.resizer.ResizeTracker', {
this.startBox = this.el.getBox();
},
- /**
+ /**
* @private
* Returns the object that will be resized on every mousemove event.
* If dynamic is false, this will be a proxy, otherwise it will be our actual target.
@@ -104,6 +123,8 @@ Ext.define('Ext.resizer.ResizeTracker', {
ratio,
widthAdjust = 0,
heightAdjust = 0,
+ snappedWidth,
+ snappedHeight,
adjustX = 0,
adjustY = 0,
dragRatio,
@@ -168,16 +189,49 @@ Ext.define('Ext.resizer.ResizeTracker', {
y: box.y + adjustY
};
+ // Snap value between stops according to configured increments
+ snappedWidth = Ext.Number.snap(newBox.width, me.widthIncrement);
+ snappedHeight = Ext.Number.snap(newBox.height, me.heightIncrement);
+ if (snappedWidth != newBox.width || snappedHeight != newBox.height){
+ switch (region) {
+ case 'northeast':
+ newBox.y -= snappedHeight - newBox.height;
+ break;
+ case 'north':
+ newBox.y -= snappedHeight - newBox.height;
+ break;
+ case 'southwest':
+ newBox.x -= snappedWidth - newBox.width;
+ break;
+ case 'west':
+ newBox.x -= snappedWidth - newBox.width;
+ break;
+ case 'northwest':
+ newBox.x -= snappedWidth - newBox.width;
+ newBox.y -= snappedHeight - newBox.height;
+ }
+ newBox.width = snappedWidth;
+ newBox.height = snappedHeight;
+ }
+
// out of bounds
if (newBox.width < me.minWidth || newBox.width > me.maxWidth) {
newBox.width = Ext.Number.constrain(newBox.width, me.minWidth, me.maxWidth);
- newBox.x = me.lastX || newBox.x;
+
+ // Re-adjust the X position if we were dragging the west side
+ if (adjustX) {
+ newBox.x = box.x + (box.width - newBox.width);
+ }
} else {
me.lastX = newBox.x;
}
if (newBox.height < me.minHeight || newBox.height > me.maxHeight) {
newBox.height = Ext.Number.constrain(newBox.height, me.minHeight, me.maxHeight);
- newBox.y = me.lastY || newBox.y;
+
+ // Re-adjust the Y position if we were dragging the north side
+ if (adjustY) {
+ newBox.y = box.y + (box.height - newBox.height);
+ }
} else {
me.lastY = newBox.y;
}
@@ -267,4 +321,6 @@ Ext.define('Ext.resizer.ResizeTracker', {
}
}
});
-
\ No newline at end of file
+
+
+