From 8eca7b8f45885d20c13f1bf64cad8bee5fc1d5c5 Mon Sep 17 00:00:00 2001 From: Uri Gilad Date: Fri, 29 Mar 2013 03:03:14 +0300 Subject: Draggable: Set explicit width/height instead of right/bottom css. Fixes #7772 --- ui/draggable.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ui') diff --git a/ui/draggable.js b/ui/draggable.js index 68222b0d5..826098feb 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -220,6 +220,10 @@ $.widget("ui.draggable", $.ui.mouse, { $.ui.ddmanager.prepareOffsets(this, event); } + // Reset helper's right/bottom css if they're set and set explicit width/height instead + // as this prevents resizing of elements with right/bottom set (see #7772) + this._normalizeRightBottom(); + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) @@ -632,6 +636,17 @@ $.widget("ui.draggable", $.ui.mouse, { } }, + _normalizeRightBottom: function() { + if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) { + this.helper.width( this.helper.width() ); + this.helper.css( "right", "auto" ); + } + if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) { + this.helper.height( this.helper.height() ); + this.helper.css( "bottom", "auto" ); + } + }, + // From now on bulk stuff - mainly helpers _trigger: function( type, event, ui ) { -- cgit v1.2.3