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

This commit is contained in:
Eduardo Lundgren 2008-11-10 06:39:52 +00:00
parent ad0cdb776e
commit 2ab2f3c7e1
4 changed files with 15 additions and 13 deletions

View File

@ -106,19 +106,19 @@ $.ui = {
return has; return has;
}, },
intersectHeight: function(aTop, bTop, bHeight) { isOverHeight: function(y, bTop, bHeight) {
//Determines when "aTop" element coordinate intersects with b element height //Determines when "y" coordinate intersects with b element height
return (aTop > bTop) && (aTop < (bTop + bHeight)); return (y > bTop) && (y < (bTop + bHeight));
}, },
intersectWidth: function(aLeft, bLeft, bWidth) { isOverWidth: function(x, bLeft, bWidth) {
//Determines when "aLeft" element coordinate intersects with b element width //Determines when "x" coordinate intersects with b element width
return (aLeft > bLeft) && (aLeft < (bLeft + bWidth)); 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" //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);
} }
}; };

View File

@ -606,7 +606,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
var itemHeight = o.height, itemWidth = o.width; var itemHeight = o.height, itemWidth = o.width;
var itemTop = o.top, itemLeft = o.left; 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) { $.each(inst.sortables, function(i) {

View File

@ -163,8 +163,10 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
break; break;
case 'pointer': 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 var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
&& 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); 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; break;
case 'touch': case 'touch':
return ( return (

View File

@ -160,8 +160,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
var itemHeight = item.height, itemWidth = item.width; var itemHeight = item.height, itemWidth = item.width;
var itemTop = item.top, itemLeft = item.left; var itemTop = item.top, itemLeft = item.left;
var isOverElementHeight = $.ui.intersectHeight(helperTop + dyClick, itemTop, itemHeight); var isOverElementHeight = $.ui.isOverHeight(helperTop + dyClick, itemTop, itemHeight);
var isOverElementWidth = $.ui.intersectWidth(helperLeft + dxClick, itemLeft, itemWidth); var isOverElementWidth = $.ui.isOverWidth(helperLeft + dxClick, itemLeft, itemWidth);
var isOverElement = isOverElementHeight && isOverElementWidth; var isOverElement = isOverElementHeight && isOverElementWidth;
var verticalDirection = this._getDragVerticalDirection(); var verticalDirection = this._getDragVerticalDirection();
var horizontalDirection = this._getDragHorizontalDirection(); var horizontalDirection = this._getDragHorizontalDirection();