Interaction: Added some comments.

This commit is contained in:
Scott González 2012-01-28 10:16:36 -05:00
parent 3c6e8a7b91
commit a87c1dc068

View File

@ -27,6 +27,20 @@ $.widget( "ui.interaction", {
} }
}, },
/** abstract methods **/
// _start: function( event, pointerPosition )
// _move: function( event, pointerPosition )
// _stop: function( event, pointerPosition )
/** protected **/
_isValidTarget: function( target ) {
return true;
},
/** internal **/
// a pass through to _interactionStart() which tracks the hook that was used // a pass through to _interactionStart() which tracks the hook that was used
_startProxy: function( hook ) { _startProxy: function( hook ) {
var that = this; var that = this;
@ -67,10 +81,6 @@ $.widget( "ui.interaction", {
_interactionStop: function( event, pointerPosition ) { _interactionStop: function( event, pointerPosition ) {
this._stop( event, pointerPosition ); this._stop( event, pointerPosition );
interaction.started = false; interaction.started = false;
},
_isValidTarget: function( target ) {
return true;
} }
}); });
@ -84,6 +94,7 @@ interaction.hooks.mouse = {
setup: function( widget, start ) { setup: function( widget, start ) {
widget._bind({ widget._bind({
"mousedown": function( event ) { "mousedown": function( event ) {
// only react to the primary button
if ( event.which === 1 ) { if ( event.which === 1 ) {
var started = start( event, event.target, { var started = start( event, event.target, {
x: event.pageX, x: event.pageX,
@ -91,6 +102,7 @@ interaction.hooks.mouse = {
}); });
if ( started ) { if ( started ) {
// prevent selection
event.preventDefault(); event.preventDefault();
} }
} }