]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Removed $.ui.isOver() and $.ui.isOverAxis(). Fixes #8891 - Remove $.ui.isOver...
authorScott González <scott.gonzalez@gmail.com>
Thu, 6 Dec 2012 19:42:10 +0000 (14:42 -0500)
committerScott González <scott.gonzalez@gmail.com>
Thu, 6 Dec 2012 19:42:10 +0000 (14:42 -0500)
ui/jquery.ui.core.js
ui/jquery.ui.droppable.js
ui/jquery.ui.sortable.js

index 2886343764ef4b29ae3d90c6b9a9d733fba7fc4e..17fad86b4c8d32cc1fedc3c702076ddc96d1d58c 100644 (file)
@@ -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 );
        }
 });
 
index 9d904992da9974b59ac4b449501ba46b191f9180..aebca8fae6c9e8f8475bf85206e4bb2ebeada4be 100644 (file)
  */
 (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
index b1fb642fee4a9f5d7e5c9df091575bb0d164e678..e142a0edeb874e244c3baf6841682e11fa125b92 100644 (file)
 
 /*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();