Skip to content

Commit 176b9c0

Browse files
committed
We can move the topOnly check into the update and be done with it
1 parent 7695afd commit 176b9c0

4 files changed

Lines changed: 6 additions & 18 deletions

File tree

v3/src/input/local/inc/ProcessDownEvents.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ var ProcessDownEvents = function (pointer)
1919
this.events.dispatch(new InputEvent.GAME_OBJECT_DOWN(pointer, gameObject));
2020

2121
gameObject.input.onDown(gameObject, pointer, gameObject.input.localX, gameObject.input.localY);
22-
23-
if (this.topOnly)
24-
{
25-
break;
26-
}
2722
}
2823
};
2924

v3/src/input/local/inc/ProcessOverOutEvents.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ var ProcessOverOutEvents = function (pointer)
1111
var stillOver = [];
1212
var previouslyOver = this._over[pointer.id];
1313

14-
if (this.topOnly && currentlyOver.length)
15-
{
16-
this.sortGameObjects(currentlyOver);
17-
18-
// Only the top-most one counts now, ignore the rest
19-
currentlyOver.splice(1);
20-
}
21-
2214
// Go through all objects the pointer was previously over, and see if it still is.
2315
// Splits the previouslyOver array into two parts: justOut and stillOver
2416

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ var ProcessUpEvents = function (pointer)
1919
this.events.dispatch(new InputEvent.GAME_OBJECT_UP(pointer, gameObject));
2020

2121
gameObject.input.onUp(gameObject, pointer, gameObject.input.localX, gameObject.input.localY);
22-
23-
if (this.topOnly)
24-
{
25-
break;
26-
}
2722
}
2823
};
2924

v3/src/input/local/inc/Update.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ var Update = function (time, delta)
2323

2424
this.sortGameObjects(this._temp);
2525

26+
if (this.topOnly && this._temp.length)
27+
{
28+
// Only the top-most one counts now, so safely ignore the rest
29+
this._temp.splice(1);
30+
}
31+
2632
this.processDragEvents(pointer, time);
2733

2834
this.processOverOutEvents(pointer);

0 commit comments

Comments
 (0)