Skip to content

Commit ed59579

Browse files
committed
Pointer now records which camera it used and all events now carry a camera property
1 parent cbe54a1 commit ed59579

20 files changed

Lines changed: 35 additions & 13 deletions

v3/src/input/Pointer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ var Pointer = new Class({
2323

2424
this.event;
2525

26+
// The camera the Pointer interacted with during its last update
27+
// A Pointer can only ever interact with 1 camera at once, which will be the top-most camera
28+
// in the list should multiple cameras be positioned on-top of each other.
29+
this.camera = null;
30+
2631
// 0 : No button or un-initialized
2732
// 1 : Left button
2833
// 2 : Right button

v3/src/input/global/components/PointWithinHitArea.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var PointWithinHitArea = function (gameObject, x, y, camera)
1818
{
1919
input.localX = x;
2020
input.localY = y;
21-
input.camera = camera;
2221

2322
return true;
2423
}

v3/src/input/local/SceneInputManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var SceneInputManager = new Class({
2020
// A reference to this.scene.sys.displayList (set in boot)
2121
this.displayList;
2222

23-
// A reference to the this.scene.sys.cameras.cameras array (set in boot)
23+
// A reference to the this.scene.sys.cameras (set in boot)
2424
this.cameras;
2525

2626
// Should use Scene event dispatcher?

v3/src/input/local/events/DragEndEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragEndEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The local x/y coordinates of the event within the Game Object
2727
this.x = pointer.x;

v3/src/input/local/events/DragEnterEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragEnterEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The drop zone the game object was dropped on
2727
this.dropZone = dropZone;

v3/src/input/local/events/DragEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The local x/y coordinates of the event within the Game Object
2727
this.x = pointer.x;

v3/src/input/local/events/DragLeaveEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragLeaveEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The drop zone the game object was dropped on
2727
this.dropZone = dropZone;

v3/src/input/local/events/DragOverEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragOverEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The drop zone the game object was dropped on
2727
this.dropZone = dropZone;

v3/src/input/local/events/DragStartEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var DragStartEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The camera on which the input event occurred
24-
this.camera = gameObject.input.camera;
24+
this.camera = pointer.camera;
2525

2626
// The local x/y coordinates of the event within the Game Object
2727
this.x = pointer.x;

v3/src/input/local/events/DropEvent.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DropEvent = new Class({
2020
// The Game Object the event occurred on
2121
this.gameObject = gameObject;
2222

23+
// The camera on which the input event occurred
24+
this.camera = pointer.camera;
25+
2326
// The drop zone the game object was dropped on
2427
this.dropZone = dropZone;
2528
}

0 commit comments

Comments
 (0)