Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/89813


Change subject: Use dimensions cached in resizeInfo for resize calculations
......................................................................

Use dimensions cached in resizeInfo for resize calculations

The logic requires the size of $resizable when the resizing started.
This is already stored in this.resizeInfo, but for some reason the
code recalculates every time, which is both inefficient and wrong
(but not a problem at the moment as $resizable doesn't change size
until resizeEnd).

Change-Id: I37a3c98e24b9e7d5e1970212975cef5ce9ef8a99
---
M modules/ve/ce/ve.ce.ResizableNode.js
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/13/89813/1

diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index 3339730..e790dee 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -251,18 +251,18 @@
                }
 
                // Unconstrained dimensions and ratio
-               newWidth = Math.max( Math.min( this.$resizable.width() + 
diff.x, max ), min );
-               newHeight = Math.max( Math.min( this.$resizable.height() + 
diff.y, max ), min );
+               newWidth = Math.max( Math.min( this.resizeInfo.width + diff.x, 
max ), min );
+               newHeight = Math.max( Math.min( this.resizeInfo.height + 
diff.y, max ), min );
                newRatio = newWidth / newHeight;
 
                // Fix the ratio
                if ( this.ratio > newRatio ) {
                        dimensions.width = newWidth;
-                       dimensions.height = this.$resizable.height() +
-                               ( newWidth - this.$resizable.width() ) / 
this.ratio;
+                       dimensions.height = this.resizeInfo.height +
+                               ( newWidth - this.resizeInfo.width ) / 
this.ratio;
                } else {
-                       dimensions.width = this.$resizable.width() +
-                               ( newHeight - this.$resizable.height() ) * 
this.ratio;
+                       dimensions.width = this.resizeInfo.width +
+                               ( newHeight - this.resizeInfo.height ) * 
this.ratio;
                        dimensions.height = newHeight;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/89813
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37a3c98e24b9e7d5e1970212975cef5ce9ef8a99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to