aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-09-17 09:33:01 -0400
committerScott González <scott.gonzalez@gmail.com>2013-10-24 09:19:41 -0400
commitd0002569d381dba6e8cf84de280d093e0a9566ec (patch)
treefc266b7ba69980843da2440adc32a9a131d7dfb0
parentd6f85644d4bcf9b53e83cb7f0e4ed4716726ffc3 (diff)
downloadjquery-ui-d0002569d381dba6e8cf84de280d093e0a9566ec.tar.gz
jquery-ui-d0002569d381dba6e8cf84de280d093e0a9566ec.zip
Droppable: Moved isOverAxis() into $.ui.intersect().
-rw-r--r--ui/jquery.ui.droppable.js43
1 files changed, 22 insertions, 21 deletions
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index a51c3a335..d21d1790a 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -16,10 +16,6 @@
*/
(function( $, undefined ) {
-function isOverAxis( x, reference, size ) {
- return ( x >= reference ) && ( x < ( reference + size ) );
-}
-
$.widget( "ui.droppable", {
version: "@VERSION",
widgetEventPrefix: "drop",
@@ -204,23 +200,28 @@ $.widget( "ui.droppable", {
});
-$.ui.intersect = function( draggable, droppable, toleranceMode ) {
-
- if ( !droppable.offset ) {
- return false;
+$.ui.intersect = (function() {
+ function isOverAxis( x, reference, size ) {
+ return ( x >= reference ) && ( x < ( reference + size ) );
}
- var draggableLeft, draggableTop,
- x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
- y1 = ( draggable.positionAbs || draggable.position.absolute ).top,
- x2 = x1 + draggable.helperProportions.width,
- y2 = y1 + draggable.helperProportions.height,
- l = droppable.offset.left,
- t = droppable.offset.top,
- r = l + droppable.proportions().width,
- b = t + droppable.proportions().height;
-
- switch ( toleranceMode ) {
+ return function( draggable, droppable, toleranceMode ) {
+
+ if ( !droppable.offset ) {
+ return false;
+ }
+
+ var draggableLeft, draggableTop,
+ x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
+ y1 = ( draggable.positionAbs || draggable.position.absolute ).top,
+ x2 = x1 + draggable.helperProportions.width,
+ y2 = y1 + draggable.helperProportions.height,
+ l = droppable.offset.left,
+ t = droppable.offset.top,
+ r = l + droppable.proportions().width,
+ b = t + droppable.proportions().height;
+
+ switch ( toleranceMode ) {
case "fit":
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
case "intersect":
@@ -245,8 +246,8 @@ $.ui.intersect = function( draggable, droppable, toleranceMode ) {
default:
return false;
}
-
-};
+ };
+})();
/*
This manager tracks offsets of draggables and droppables