Skip to content

Commit 91a0b41

Browse files
committed
Up handler goes through draggable list.
1 parent 812ea7d commit 91a0b41

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

v3/src/input/local/components/ProcessUpEvents.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ var ProcessUpEvents = function (pointer, currentlyOver)
88
// still fire an UP event, even though it never previously received a DOWN event.
99
var previouslyDown = this.children.down[pointer.id].concat(currentlyOver);
1010

11+
var i;
12+
var interactiveObject;
13+
1114
if (previouslyDown.length === 0)
1215
{
1316
// Dispatch UP event, even though nothing was down previously
@@ -16,9 +19,9 @@ var ProcessUpEvents = function (pointer, currentlyOver)
1619
else
1720
{
1821
// Go through all objects the pointer was previously down on and set to up
19-
for (var i = 0; i < previouslyDown.length; i++)
22+
for (i = 0; i < previouslyDown.length; i++)
2023
{
21-
var interactiveObject = previouslyDown[i];
24+
interactiveObject = previouslyDown[i];
2225

2326
if (!this.topOnly || (this.topOnly && i === 0))
2427
{
@@ -31,6 +34,31 @@ var ProcessUpEvents = function (pointer, currentlyOver)
3134

3235
// Reset the down array
3336
this.children.down[pointer.id].length = 0;
37+
38+
// Now check the list of Draggable Items for this pointer
39+
40+
41+
for (i = 0; i < this.children.draggable.length; i++)
42+
{
43+
interactiveObject = this.children.draggable[pointer.id];
44+
45+
if (!interactiveObject.enabled)
46+
{
47+
continue;
48+
}
49+
50+
if (pointer.justUp && interactiveObject.isDragged)
51+
{
52+
// Drag End
53+
this.childOnDragEnd(pointer, interactiveObject, currentlyOver);
54+
}
55+
else if (interactiveObject.isDragged)
56+
{
57+
// Drag
58+
this.childOnDrag(pointer, interactiveObject, currentlyOver);
59+
}
60+
}
61+
3462
};
3563

3664
module.exports = ProcessUpEvents;

0 commit comments

Comments
 (0)