Skip to content

Commit dc05c29

Browse files
committed
Input matrix updates
1 parent b4a7b92 commit dc05c29

4 files changed

Lines changed: 21 additions & 18 deletions

File tree

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: '39f826c0-54fe-11e7-90c1-d1d02aa41ae8'
2+
build: '2ac4ba60-552b-11e7-965c-39a419b0ea9b'
33
};
44
module.exports = CHECKSUM;

v3/src/components/TransformMatrix.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ TransformMatrix.prototype.transformPoint = function (x, y, point)
126126
var tx = matrix[4];
127127
var ty = matrix[5];
128128

129-
point.x = x * a + y * c + tx;
130-
point.y = x * b + y * d + ty;
129+
// point.x = x * a + y * c + tx;
130+
// point.y = x * b + y * d + ty;
131+
132+
var id = 1 / ((a * d) + (c * -b));
133+
134+
point.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id);
135+
point.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id);
131136

132137
return point;
133138
};

v3/src/input/components/GetTransformedPoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var GetTransformedPoint = function (matrix, gameObject, x, y, output)
1111
if (output === undefined) { output = { x: 0, y: 0 }; }
1212

1313
matrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY);
14-
matrix.invert();
14+
// matrix.invert();
1515
matrix.transformPoint(x, y, output);
1616

1717
// var a = matrix.matrix[0];

v3/src/input/components/PointWithinGameObject.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33

44
var PointWithinGameObject = function (gameObject, x, y)
55
{
6-
// var width = gameObject.width;
7-
// var height = gameObject.height;
8-
// var x1 = -width * gameObject.originX;
6+
var width = gameObject.displayWidth;
7+
var height = gameObject.displayHeight;
98

10-
// if (x >= x1 && x < x1 + width)
11-
// {
12-
// var y1 = -height * gameObject.originY;
9+
var x1 = -width * gameObject.originX;
1310

14-
// if (y >= y1 && y < y1 + height)
15-
// {
16-
// return true;
17-
// }
18-
// }
11+
if (x >= x1 && x < x1 + width)
12+
{
13+
var y1 = -height * gameObject.originY;
1914

20-
// return false;
21-
22-
return (x >= gameObject.x && x <= gameObject.x+gameObject.width && y >= gameObject.y && y <= gameObject.y+gameObject.height);
15+
if (y >= y1 && y < y1 + height)
16+
{
17+
return true;
18+
}
19+
}
2320

21+
return false;
2422
};
2523

2624
module.exports = PointWithinGameObject;

0 commit comments

Comments
 (0)