mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Change name of intersect methods to isOverHeight/isOverWidth/isOver.
This commit is contained in:
parent
ad0cdb776e
commit
2ab2f3c7e1
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user