Sortable: Using the new core intersectHeight/intersectWidth methods.

This commit is contained in:
Eduardo Lundgren 2008-11-10 05:17:12 +00:00
parent 91377e4e5c
commit acf15c4f08

View File

@ -156,19 +156,12 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
_intersectsWithEdge: function(item) { _intersectsWithEdge: function(item) {
var dyClick = this.offset.click.top, dxClick = this.offset.click.left; var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
var helperHeight = this.helperProportions.height, helperWidth = this.helperProportions.width;
var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
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 = var isOverElementHeight = $.ui.intersectHeight(helperTop + dyClick, itemTop, itemHeight);
((helperTop + dyClick) > itemTop) && var isOverElementWidth = $.ui.intersectWidth(helperLeft + dxClick, itemLeft, itemWidth);
((helperTop + dyClick) < (itemTop + itemHeight));
var isOverElementWidth =
((helperLeft + dxClick) > itemLeft) &&
((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();