From 59e7a7bdcfe6772c6cd5d502d06f246fe4e9b882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Inez=20Korczyn=CC=81ski?= Date: Sat, 29 Jun 2013 21:47:58 -0700 Subject: [PATCH] Simplify ve.ce.ResizableNode by removing code for 'transition' which is not used anyway Change-Id: I561395cab3271a93f43d14d17db0c2dcee74ae4a --- modules/ve/ce/ve.ce.ResizableNode.js | 52 ++++++++-------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/modules/ve/ce/ve.ce.ResizableNode.js b/modules/ve/ce/ve.ce.ResizableNode.js index a6d1f124f9..05e567171e 100644 --- a/modules/ve/ce/ve.ce.ResizableNode.js +++ b/modules/ve/ce/ve.ce.ResizableNode.js @@ -44,13 +44,6 @@ ve.ce.ResizableNode = function VeCeResizableNode( $resizable ) { ve.ce.ResizableNode.static = {}; -/** - * Animate between sizes. - * - * @type {boolean} - */ -ve.ce.ResizableNode.static.transition = true; - /* Methods */ /** @@ -239,8 +232,7 @@ ve.ce.ResizableNode.prototype.onDocumentMouseMove = function ( e ) { * @method */ ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () { - var transition = this.constructor.static.transition, - offset = this.model.getOffset(), + var offset = this.model.getOffset(), width = this.$resizeHandles.outerWidth(), height = this.$resizeHandles.outerHeight(), surfaceModel = this.getRoot().getSurface().getModel(), @@ -251,35 +243,21 @@ ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () { this.$resizeHandles.removeClass( 've-ui-resizableNode-handles-resizing' ); $( this.getElementDocument() ).off( '.ve-ce-resizableNode' ); this.resizing = false; - - // Transition image resize - if ( transition ) { - this.$resizable.addClass( 've-ce-resizableNode-transitioning' ); - } this.$resizable.css( { 'width': width, 'height': height } ); - // Allow resize to occur before re-rendering - setTimeout( ve.bind( function () { - if ( transition ) { - // Prevent further transitioning - this.$resizable.removeClass( 've-ce-resizableNode-transitioning' ); - } + // Apply changes to the model + 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 + ); + } - // Apply changes to the model - 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 ); + this.emit( 'resize' ); };