]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Make sure positional constraints are never applied to ui.originalPosition
authorMike Sherov <mike.sherov@gmail.com>
Mon, 21 Oct 2013 14:48:54 +0000 (10:48 -0400)
committerMike Sherov <mike.sherov@gmail.com>
Mon, 21 Oct 2013 15:20:03 +0000 (11:20 -0400)
ui/jquery.ui.draggable.js

index 651dee3d718d66f7c71150101c6af1e789f96183..e528d194ef8dffd5b990b6478f213ba2fb7446d8 100644 (file)
@@ -166,7 +166,7 @@ $.widget("ui.draggable", $.ui.mouse, {
                });
 
                //Generate the original position
-               this.originalPosition = this.position = this._generatePosition(event);
+               this.originalPosition = this.position = this._generatePosition( event, false );
                this.originalPageX = event.pageX;
                this.originalPageY = event.pageY;
 
@@ -208,7 +208,7 @@ $.widget("ui.draggable", $.ui.mouse, {
                }
 
                //Compute the helpers position
-               this.position = this._generatePosition(event);
+               this.position = this._generatePosition( event, true );
                this.positionAbs = this._convertPositionTo("absolute");
 
                //Call plugins and callbacks and use the resulting position if something is returned
@@ -488,7 +488,7 @@ $.widget("ui.draggable", $.ui.mouse, {
 
        },
 
-       _generatePosition: function(event) {
+       _generatePosition: function( event, constrainPosition ) {
 
                var containment, co, top, left,
                        o = this.options,
@@ -513,7 +513,7 @@ $.widget("ui.draggable", $.ui.mouse, {
                 */
 
                // If we are not dragging yet, we won't check for options
-               if ( this.originalPosition ) {
+               if ( constrainPosition ) {
                        if ( this.containment ) {
                                if ( this.relative_container ){
                                        co = this.relative_container.offset();