aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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