Draggable: Pass pointer position in the ui hash for all events.

This commit is contained in:
Scott González 2012-01-15 13:34:46 -05:00
parent 66a594ec76
commit 003bbf42fc

View File

@ -101,7 +101,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
this._preparePosition( pointerPosition ); this._preparePosition( pointerPosition );
// If user cancels start, don't allow dragging // If user cancels start, don't allow dragging
if ( this._trigger( "start", event, this._uiHash() ) === false ) { if ( this._trigger( "start", event, this._uiHash( pointerPosition ) ) === false ) {
return false; return false;
} }
@ -115,7 +115,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
this._preparePosition( pointerPosition ); this._preparePosition( pointerPosition );
// If user cancels drag, don't move the element // If user cancels drag, don't move the element
if ( this._trigger( "drag", event, this._uiHash() ) === false ) { if ( this._trigger( "drag", event, this._uiHash( pointerPosition ) ) === false ) {
return; return;
} }
@ -129,7 +129,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
this._preparePosition( pointerPosition ); this._preparePosition( pointerPosition );
// If user cancels stop, leave helper there, disallow any CSS changes // If user cancels stop, leave helper there, disallow any CSS changes
if ( this._trigger( "stop", event, this._uiHash() ) !== false ) { if ( this._trigger( "stop", event, this._uiHash( pointerPosition ) ) !== false ) {
this._setCss(); this._setCss();
if ( this.options.helper ) { if ( this.options.helper ) {
this.dragEl.remove(); this.dragEl.remove();
@ -261,11 +261,12 @@ $.widget( "ui.draggable", $.ui.interaction, {
}); });
}, },
_uiHash: function() { _uiHash: function( pointerPosition ) {
// TODO: add originalPosition // TODO: add originalPosition
var ret = { var ret = {
position: this.position, position: this.position,
offset: this.offset offset: this.offset,
pointer: pointerPosition
}; };
if ( this.options.helper ) { if ( this.options.helper ) {