From 3ec0c2e5728da9b9b9955dfe18073d3985e61a52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 6 Dec 2012 14:42:10 -0500 Subject: [PATCH] Core: Removed $.ui.isOver() and $.ui.isOverAxis(). Fixes #8891 - Remove $.ui.isOver() and $.ui.isOverAxis(). --- ui/jquery.ui.core.js | 10 ---------- ui/jquery.ui.droppable.js | 6 +++++- ui/jquery.ui.sortable.js | 12 ++++++++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 288634376..17fad86b4 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -313,16 +313,6 @@ $.extend( $.ui, { has = ( el[ scroll ] > 0 ); el[ scroll ] = 0; return has; - }, - - // these are odd functions, fix the API or move into individual plugins - isOverAxis: function( x, reference, size ) { - //Determines when x coordinate is over "b" element axis - return ( x > reference ) && ( x < ( reference + size ) ); - }, - isOver: function( y, x, top, left, height, width ) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); } }); diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 9d904992d..aebca8fae 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -16,6 +16,10 @@ */ (function( $, undefined ) { +function isOverAxis( x, reference, size ) { + return ( x > reference ) && ( x < ( reference + size ) ); +} + $.widget("ui.droppable", { version: "@VERSION", widgetEventPrefix: "drop", @@ -203,7 +207,7 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { case 'pointer': 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); - return $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOverAxis( draggableTop, t, droppable.proportions.height ) && isOverAxis( draggableLeft, l, droppable.proportions.width ) case 'touch': return ( (y1 >= t && y1 <= b) || // Top edge touching diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index b1fb642fe..e142a0ede 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -17,6 +17,10 @@ /*jshint loopfunc: true */ +function isOverAxis( x, reference, size ) { + return ( x > reference ) && ( x < ( reference + size ) ); +} + $.widget("ui.sortable", $.ui.mouse, { version: "@VERSION", widgetEventPrefix: "sort", @@ -536,8 +540,8 @@ $.widget("ui.sortable", $.ui.mouse, { _intersectsWithPointer: function(item) { - var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), - isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + var isOverElementHeight = (this.options.axis === 'x') || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === 'y') || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), isOverElement = isOverElementHeight && isOverElementWidth, verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); @@ -554,8 +558,8 @@ $.widget("ui.sortable", $.ui.mouse, { _intersectsWithSides: function(item) { - var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), - isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); -- 2.39.5