diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-05-31 15:00:50 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-05-31 15:01:15 -0400 |
commit | 16c375d374c5675265b5d8c5cd06c7170d0e8b58 (patch) | |
tree | d1dfa300fbaec61f82d79eb97b56af77258a3ce2 | |
parent | a9bb4880d39f77ec0e9d28c8cbb9ebb5ee65c6ad (diff) | |
download | jquery-ui-16c375d374c5675265b5d8c5cd06c7170d0e8b58.tar.gz jquery-ui-16c375d374c5675265b5d8c5cd06c7170d0e8b58.zip |
Dialog: Use proper position data after drag and resize. Fixes #9351 - Dialog: Incorrect value for position option after resize.
-rw-r--r-- | ui/jquery.ui.dialog.js | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 16095292c..b94757505 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -454,10 +454,15 @@ $.widget( "ui.dialog", { that._trigger( "drag", event, filteredUi( ui ) ); }, stop: function( event, ui ) { - options.position = [ - ui.position.left - that.document.scrollLeft(), - ui.position.top - that.document.scrollTop() - ]; + var left = ui.offset.left - that.document.scrollLeft(), + top = ui.offset.top - that.document.scrollTop(); + + options.position = { + my: "left top", + at: "left" + (left >= 0 ? "+" : "") + left + " " + + "top" + (top >= 0 ? "+" : "") + top, + of: that.window + }; $( this ).removeClass("ui-dialog-dragging"); that._unblockFrames(); that._trigger( "dragStop", event, filteredUi( ui ) ); @@ -503,8 +508,18 @@ $.widget( "ui.dialog", { that._trigger( "resize", event, filteredUi( ui ) ); }, stop: function( event, ui ) { - options.height = $( this ).height(); - options.width = $( this ).width(); + var offset = that.uiDialog.offset(), + left = offset.left - that.document.scrollLeft(), + top = offset.top - that.document.scrollTop(); + + options.height = that.uiDialog.height(); + options.width = that.uiDialog.width(); + options.position = { + my: "left top", + at: "left" + (left >= 0 ? "+" : "") + left + " " + + "top" + (top >= 0 ? "+" : "") + top, + of: that.window + }; $( this ).removeClass("ui-dialog-resizing"); that._unblockFrames(); that._trigger( "resizeStop", event, filteredUi( ui ) ); |