diff --git a/ui/ui.core.js b/ui/ui.core.js index 3420d48b4..fe0737f92 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -106,19 +106,19 @@ $.ui = { return has; }, - intersectHeight: function(aTop, bTop, bHeight) { - //Determines when "aTop" element coordinate intersects with b element height - return (aTop > bTop) && (aTop < (bTop + bHeight)); + isOverHeight: function(y, bTop, bHeight) { + //Determines when "y" coordinate intersects with b element height + return (y > bTop) && (y < (bTop + bHeight)); }, - intersectWidth: function(aLeft, bLeft, bWidth) { - //Determines when "aLeft" element coordinate intersects with b element width - return (aLeft > bLeft) && (aLeft < (bLeft + bWidth)); + isOverWidth: function(x, bLeft, bWidth) { + //Determines when "x" coordinate intersects with b element width + return (x > bLeft) && (x < (bLeft + bWidth)); }, - intersects: function(aTop, aLeft, bTop, bLeft, bHeight, bWidth) { + isOver: function(y, x, bTop, bLeft, bHeight, bWidth) { //Determines when element "a" coordinates intersects with element "b" - return $.ui.intersectHeight(aTop, bTop, bHeight) && $.ui.intersectWidth(aLeft, bLeft, bWidth); + return $.ui.isOverHeight(y, bTop, bHeight) && $.ui.isOverWidth(x, bLeft, bWidth); } }; diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index 551550ed4..98934fdf2 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -606,7 +606,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { var itemHeight = o.height, itemWidth = o.width; var itemTop = o.top, itemLeft = o.left; - return $.ui.intersects(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); }; $.each(inst.sortables, function(i) { diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js index 2de012351..92a779611 100644 --- a/ui/ui.droppable.js +++ b/ui/ui.droppable.js @@ -163,8 +163,10 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half break; case 'pointer': - return (l < ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) && ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) < r - && t < ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) && ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) < b); + var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), + isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOver; break; case 'touch': return ( diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index c8fbad184..b92e20166 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -160,8 +160,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { var itemHeight = item.height, itemWidth = item.width; var itemTop = item.top, itemLeft = item.left; - var isOverElementHeight = $.ui.intersectHeight(helperTop + dyClick, itemTop, itemHeight); - var isOverElementWidth = $.ui.intersectWidth(helperLeft + dxClick, itemLeft, itemWidth); + var isOverElementHeight = $.ui.isOverHeight(helperTop + dyClick, itemTop, itemHeight); + var isOverElementWidth = $.ui.isOverWidth(helperLeft + dxClick, itemLeft, itemWidth); var isOverElement = isOverElementHeight && isOverElementWidth; var verticalDirection = this._getDragVerticalDirection(); var horizontalDirection = this._getDragHorizontalDirection();