Skip to content
Permalink
Browse files

Change name of intersect methods to isOverHeight/isOverWidth/isOver.

  • Loading branch information...
eduardolundgren committed Nov 10, 2008
1 parent ad0cdb7 commit 2ab2f3c7e10ffd109f8b2409ace6adcbd5cbcb61
Showing with 15 additions and 13 deletions.
  1. +8 −8 ui/ui.core.js
  2. +1 −1 ui/ui.draggable.js
  3. +4 −2 ui/ui.droppable.js
  4. +2 −2 ui/ui.sortable.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);
}
};

@@ -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) {
@@ -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 (
@@ -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();

0 comments on commit 2ab2f3c

Please sign in to comment.
You can’t perform that action at this time.