diff options
Diffstat (limited to 'ui/resizable.js')
-rw-r--r-- | ui/resizable.js | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/ui/resizable.js b/ui/resizable.js index 869cc3ebe..b2e3a6626 100644 --- a/ui/resizable.js +++ b/ui/resizable.js @@ -321,22 +321,14 @@ $.widget("ui.resizable", $.ui.mouse, { _mouseDrag: function(event) { - var data, - el = this.helper, props = {}, + var data, props, smp = this.originalMousePosition, a = this.axis, dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0, trigger = this._change[a]; - this.prevPosition = { - top: this.position.top, - left: this.position.left - }; - this.prevSize = { - width: this.size.width, - height: this.size.height - }; + this._updatePrevProperties(); if (!trigger) { return false; @@ -355,26 +347,16 @@ $.widget("ui.resizable", $.ui.mouse, { this._propagate("resize", event); - if ( this.position.top !== this.prevPosition.top ) { - props.top = this.position.top + "px"; - } - if ( this.position.left !== this.prevPosition.left ) { - props.left = this.position.left + "px"; - } - if ( this.size.width !== this.prevSize.width ) { - props.width = this.size.width + "px"; - } - if ( this.size.height !== this.prevSize.height ) { - props.height = this.size.height + "px"; - } - el.css( props ); + props = this._applyChanges(); if ( !this._helper && this._proportionallyResizeElements.length ) { this._proportionallyResize(); } if ( !$.isEmptyObject( props ) ) { + this._updatePrevProperties(); this._trigger( "resize", event, this.ui() ); + this._applyChanges(); } return false; @@ -423,6 +405,38 @@ $.widget("ui.resizable", $.ui.mouse, { }, + _updatePrevProperties: function() { + this.prevPosition = { + top: this.position.top, + left: this.position.left + }; + this.prevSize = { + width: this.size.width, + height: this.size.height + }; + }, + + _applyChanges: function() { + var props = {}; + + if ( this.position.top !== this.prevPosition.top ) { + props.top = this.position.top + "px"; + } + if ( this.position.left !== this.prevPosition.left ) { + props.left = this.position.left + "px"; + } + if ( this.size.width !== this.prevSize.width ) { + props.width = this.size.width + "px"; + } + if ( this.size.height !== this.prevSize.height ) { + props.height = this.size.height + "px"; + } + + this.helper.css( props ); + + return props; + }, + _updateVirtualBoundaries: function(forceAspectRatio) { var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, o = this.options; |