mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Simplify ve.ce.ResizableNode by removing code for 'transition' which is not used anyway"
This commit is contained in:
commit
f8d7314636
|
@ -44,13 +44,6 @@ ve.ce.ResizableNode = function VeCeResizableNode( $resizable ) {
|
||||||
|
|
||||||
ve.ce.ResizableNode.static = {};
|
ve.ce.ResizableNode.static = {};
|
||||||
|
|
||||||
/**
|
|
||||||
* Animate between sizes.
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
ve.ce.ResizableNode.static.transition = true;
|
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,8 +232,7 @@ ve.ce.ResizableNode.prototype.onDocumentMouseMove = function ( e ) {
|
||||||
* @method
|
* @method
|
||||||
*/
|
*/
|
||||||
ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () {
|
ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () {
|
||||||
var transition = this.constructor.static.transition,
|
var offset = this.model.getOffset(),
|
||||||
offset = this.model.getOffset(),
|
|
||||||
width = this.$resizeHandles.outerWidth(),
|
width = this.$resizeHandles.outerWidth(),
|
||||||
height = this.$resizeHandles.outerHeight(),
|
height = this.$resizeHandles.outerHeight(),
|
||||||
surfaceModel = this.getRoot().getSurface().getModel(),
|
surfaceModel = this.getRoot().getSurface().getModel(),
|
||||||
|
@ -251,35 +243,21 @@ ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () {
|
||||||
this.$resizeHandles.removeClass( 've-ui-resizableNode-handles-resizing' );
|
this.$resizeHandles.removeClass( 've-ui-resizableNode-handles-resizing' );
|
||||||
$( this.getElementDocument() ).off( '.ve-ce-resizableNode' );
|
$( this.getElementDocument() ).off( '.ve-ce-resizableNode' );
|
||||||
this.resizing = false;
|
this.resizing = false;
|
||||||
|
|
||||||
// Transition image resize
|
|
||||||
if ( transition ) {
|
|
||||||
this.$resizable.addClass( 've-ce-resizableNode-transitioning' );
|
|
||||||
}
|
|
||||||
this.$resizable.css( { 'width': width, 'height': height } );
|
this.$resizable.css( { 'width': width, 'height': height } );
|
||||||
|
|
||||||
// Allow resize to occur before re-rendering
|
// Apply changes to the model
|
||||||
setTimeout( ve.bind( function () {
|
if ( this.model.getAttribute( 'width' ) !== width ) {
|
||||||
if ( transition ) {
|
attrChanges.width = width;
|
||||||
// Prevent further transitioning
|
}
|
||||||
this.$resizable.removeClass( 've-ce-resizableNode-transitioning' );
|
if ( this.model.getAttribute( 'height' ) !== height ) {
|
||||||
}
|
attrChanges.height = height;
|
||||||
|
}
|
||||||
|
if ( !ve.isEmptyObject( attrChanges ) ) {
|
||||||
|
surfaceModel.change(
|
||||||
|
ve.dm.Transaction.newFromAttributeChanges( documentModel, offset, attrChanges ),
|
||||||
|
selection
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply changes to the model
|
this.emit( 'resize' );
|
||||||
if ( this.model.getAttribute( 'width' ) !== width ) {
|
|
||||||
attrChanges.width = width;
|
|
||||||
}
|
|
||||||
if ( this.model.getAttribute( 'height' ) !== height ) {
|
|
||||||
attrChanges.height = height;
|
|
||||||
}
|
|
||||||
if ( !ve.isEmptyObject( attrChanges ) ) {
|
|
||||||
surfaceModel.change(
|
|
||||||
ve.dm.Transaction.newFromAttributeChanges( documentModel, offset, attrChanges ),
|
|
||||||
selection
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit( 'resize' );
|
|
||||||
|
|
||||||
}, this ), transition ? 200 : 0 );
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue