mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Merge "Use dimensions cached in resizeInfo for resize calculations"
This commit is contained in:
commit
6c045e3b6d
|
@ -251,18 +251,18 @@ ve.ce.ResizableNode.prototype.onDocumentMouseMove = function ( e ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unconstrained dimensions and ratio
|
// Unconstrained dimensions and ratio
|
||||||
newWidth = Math.max( Math.min( this.$resizable.width() + diff.x, max ), min );
|
newWidth = Math.max( Math.min( this.resizeInfo.width + diff.x, max ), min );
|
||||||
newHeight = Math.max( Math.min( this.$resizable.height() + diff.y, max ), min );
|
newHeight = Math.max( Math.min( this.resizeInfo.height + diff.y, max ), min );
|
||||||
newRatio = newWidth / newHeight;
|
newRatio = newWidth / newHeight;
|
||||||
|
|
||||||
// Fix the ratio
|
// Fix the ratio
|
||||||
if ( this.ratio > newRatio ) {
|
if ( this.ratio > newRatio ) {
|
||||||
dimensions.width = newWidth;
|
dimensions.width = newWidth;
|
||||||
dimensions.height = this.$resizable.height() +
|
dimensions.height = this.resizeInfo.height +
|
||||||
( newWidth - this.$resizable.width() ) / this.ratio;
|
( newWidth - this.resizeInfo.width ) / this.ratio;
|
||||||
} else {
|
} else {
|
||||||
dimensions.width = this.$resizable.width() +
|
dimensions.width = this.resizeInfo.width +
|
||||||
( newHeight - this.$resizable.height() ) * this.ratio;
|
( newHeight - this.resizeInfo.height ) * this.ratio;
|
||||||
dimensions.height = newHeight;
|
dimensions.height = newHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue