From a87c1dc068f2fb91e18f2c46686a509822915c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 28 Jan 2012 10:16:36 -0500 Subject: [PATCH] Interaction: Added some comments. --- ui/jquery.ui.interaction.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.interaction.js b/ui/jquery.ui.interaction.js index a060e9509..01f8984e1 100644 --- a/ui/jquery.ui.interaction.js +++ b/ui/jquery.ui.interaction.js @@ -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 _startProxy: function( hook ) { var that = this; @@ -67,10 +81,6 @@ $.widget( "ui.interaction", { _interactionStop: function( event, pointerPosition ) { this._stop( event, pointerPosition ); interaction.started = false; - }, - - _isValidTarget: function( target ) { - return true; } }); @@ -84,6 +94,7 @@ interaction.hooks.mouse = { setup: function( widget, start ) { widget._bind({ "mousedown": function( event ) { + // only react to the primary button if ( event.which === 1 ) { var started = start( event, event.target, { x: event.pageX, @@ -91,6 +102,7 @@ interaction.hooks.mouse = { }); if ( started ) { + // prevent selection event.preventDefault(); } }