mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Droppable: Added pointer intersect
This commit is contained in:
parent
a28fb9f98f
commit
722e4bcf18
18
ui/jquery.ui.droppable.js
vendored
18
ui/jquery.ui.droppable.js
vendored
@ -63,7 +63,7 @@ $.widget( "ui.droppable", {
|
||||
draggableRight: ui.offset.left + this.draggableProportions.width,
|
||||
draggableBottom: ui.offset.top + this.draggableProportions.height
|
||||
},
|
||||
over = this[ handleFunc ]( edges, ui );
|
||||
over = this[ handleFunc ]( event, edges, ui );
|
||||
|
||||
// If there is sufficient overlap as deemed by tolerance
|
||||
if ( over ) {
|
||||
@ -89,7 +89,7 @@ $.widget( "ui.droppable", {
|
||||
// Determines if draggable is over droppable based on intersect tolerance
|
||||
// TODO: move all tolerance methods into a hash
|
||||
// $.ui.droppable.tolerance.intersect
|
||||
_handleIntersect: function( edges, ui ) {
|
||||
_handleIntersect: function( event, edges, ui ) {
|
||||
var xDiff = edges.draggableRight - this.offset.left,
|
||||
yDiff = edges.draggableBottom - this.offset.top,
|
||||
// TODO: is there really any need to round here?
|
||||
@ -112,7 +112,7 @@ $.widget( "ui.droppable", {
|
||||
},
|
||||
|
||||
// Determines if draggable is over droppable based on touch tolerance
|
||||
_handleTouch: function( edges, ui ) {
|
||||
_handleTouch: function( event, edges, ui ) {
|
||||
var xOverlap = edges.draggableRight >= this.offset.left &&
|
||||
ui.offset.left <= edges.right,
|
||||
yOverlap = edges.draggableBottom >= this.offset.top &&
|
||||
@ -121,6 +121,18 @@ $.widget( "ui.droppable", {
|
||||
return xOverlap && yOverlap;
|
||||
},
|
||||
|
||||
// Determines if draggable is over droppable based on touch tolerance
|
||||
_handlePointer: function( event, edges, ui ) {
|
||||
|
||||
var xOverlap = event.pageX >= this.offset.left &&
|
||||
event.pageX <= edges.right,
|
||||
yOverlap = event.pageY >= this.offset.top &&
|
||||
event.pageY <= edges.bottom;
|
||||
|
||||
return xOverlap && yOverlap;
|
||||
|
||||
},
|
||||
|
||||
// TODO: shouldn't this be dragStop?
|
||||
_mouseUp: function( event ) {
|
||||
if ( this.over ) {
|
||||
|
Loading…
Reference in New Issue
Block a user