Skip to content

Commit db113b5

Browse files
committed
Exposed the camera responsible for the input event.
1 parent c8a1dc3 commit db113b5

15 files changed

Lines changed: 43 additions & 7 deletions

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: 'acc361d0-73b5-11e7-8dc3-49219ba238d9'
2+
build: '41aa6700-73b9-11e7-89dd-e354e5abd620'
33
};
44
module.exports = CHECKSUM;

v3/src/input/InteractiveObject.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ var InteractiveObject = function (gameObject, hitArea, hitAreaCallback)
1414

1515
target: null,
1616

17+
camera: null,
18+
1719
hitArea: hitArea,
1820
hitAreaCallback: hitAreaCallback,
1921

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var HitTest = function (tempMatrix, x, y, gameObjects, camera, output)
3636
(screenPoint.y + camera.scrollY) * gameObject.scrollFactorY
3737
);
3838

39-
if (PointWithinHitArea(gameObject, point.x, point.y))
39+
if (PointWithinHitArea(gameObject, point.x, point.y, camera))
4040
{
4141
output.push(gameObject);
4242
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// x/y MUST be translated before being passed to this function,
22
// unless the gameObject is guaranteed to not be rotated or scaled in any way
33

4-
var PointWithinHitArea = function (gameObject, x, y)
4+
var PointWithinHitArea = function (gameObject, x, y, camera)
55
{
66
var input = gameObject.input;
77

8-
if (!input)
9-
{
10-
return false;
11-
}
8+
// if (!input)
9+
// {
10+
// return false;
11+
// }
1212

1313
// Normalize the origin
1414
x += gameObject.displayOriginX;
@@ -18,6 +18,7 @@ var PointWithinHitArea = function (gameObject, x, y)
1818
{
1919
input.localX = x;
2020
input.localY = y;
21+
input.camera = camera;
2122

2223
return true;
2324
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragEndEvent = 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 = gameObject.input.camera;
25+
2326
// The local x/y coordinates of the event within the Game Object
2427
this.x = pointer.x;
2528
this.y = pointer.y;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragEnterEvent = 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 = gameObject.input.camera;
25+
2326
// The drop zone the game object was dropped on
2427
this.dropZone = dropZone;
2528
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragEvent = 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 = gameObject.input.camera;
25+
2326
// The local x/y coordinates of the event within the Game Object
2427
this.x = pointer.x;
2528
this.y = pointer.y;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragLeaveEvent = 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 = gameObject.input.camera;
25+
2326
// The drop zone the game object was dropped on
2427
this.dropZone = dropZone;
2528
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragOverEvent = 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 = gameObject.input.camera;
25+
2326
// The drop zone the game object was dropped on
2427
this.dropZone = dropZone;
2528
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var DragStartEvent = 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 = gameObject.input.camera;
25+
2326
// The local x/y coordinates of the event within the Game Object
2427
this.x = pointer.x;
2528
this.y = pointer.y;

0 commit comments

Comments
 (0)