Draggable: Make sure positional constraints are never applied to ui.originalPosition

This commit is contained in:
Mike Sherov 2013-10-21 10:48:54 -04:00
parent 619261f079
commit 4bd1a9c5ba

View File

@ -166,7 +166,7 @@ $.widget("ui.draggable", $.ui.mouse, {
}); });
//Generate the original position //Generate the original position
this.originalPosition = this.position = this._generatePosition(event); this.originalPosition = this.position = this._generatePosition( event, false );
this.originalPageX = event.pageX; this.originalPageX = event.pageX;
this.originalPageY = event.pageY; this.originalPageY = event.pageY;
@ -208,7 +208,7 @@ $.widget("ui.draggable", $.ui.mouse, {
} }
//Compute the helpers position //Compute the helpers position
this.position = this._generatePosition(event); this.position = this._generatePosition( event, true );
this.positionAbs = this._convertPositionTo("absolute"); this.positionAbs = this._convertPositionTo("absolute");
//Call plugins and callbacks and use the resulting position if something is returned //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, var containment, co, top, left,
o = this.options, 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 we are not dragging yet, we won't check for options
if ( this.originalPosition ) { if ( constrainPosition ) {
if ( this.containment ) { if ( this.containment ) {
if ( this.relative_container ){ if ( this.relative_container ){
co = this.relative_container.offset(); co = this.relative_container.offset();