Droppable: Cleanup.

This commit is contained in:
Scott González 2012-01-07 11:50:16 -05:00
parent 5d029ffab0
commit 43a93e5c33

View File

@ -92,10 +92,8 @@ $.widget( "ui.droppable", {
_handleIntersect: function( event, edges, ui ) { _handleIntersect: function( event, edges, ui ) {
var xDiff = edges.draggableRight - this.offset.left, var xDiff = edges.draggableRight - this.offset.left,
yDiff = edges.draggableBottom - this.offset.top, yDiff = edges.draggableBottom - this.offset.top,
xHalfway = this.proportions.width / 2,
// Round to normalize between browsers since some handle non-integer values yHalfway = this.proportions.height / 2,
xHalfway = Math.round( this.proportions.width / 2 ),
yHalfway = Math.round( this.proportions.height / 2 ),
xOverlap = false, xOverlap = false,
yOverlap = false; yOverlap = false;
@ -122,16 +120,14 @@ $.widget( "ui.droppable", {
return xOverlap && yOverlap; return xOverlap && yOverlap;
}, },
// Determines if draggable is over droppable based on touch tolerance // Determines if draggable is over droppable based on pointer tolerance
_handlePointer: function( event, edges, ui ) { _handlePointer: function( event, edges, ui ) {
var xOverlap = event.pageX >= this.offset.left && var xOverlap = event.pageX >= this.offset.left &&
event.pageX <= edges.right, event.pageX <= edges.right,
yOverlap = event.pageY >= this.offset.top && yOverlap = event.pageY >= this.offset.top &&
event.pageY <= edges.bottom; event.pageY <= edges.bottom;
return xOverlap && yOverlap; return xOverlap && yOverlap;
}, },
// TODO: shouldn't this be dragStop? // TODO: shouldn't this be dragStop?