Skip to content

Commit 90620e9

Browse files
committed
Working through bounds and input issues
1 parent 176b9c0 commit 90620e9

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

v3/src/camera/2d/inc/PreRender.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,31 @@ var PreRender = function ()
2020
if (this.useBounds)
2121
{
2222
var bounds = this._bounds;
23-
var boundsX = bounds.x;
24-
var boundsY = bounds.y;
25-
var boundsR = Math.max(bounds.right - width, width);
26-
var boundsB = Math.max(bounds.bottom - height, height);
2723

28-
if (this.scrollX < boundsX)
24+
// width = bounds.width;
25+
// height = bounds.height;
26+
27+
// var boundsX = bounds.x;
28+
// var boundsY = bounds.y;
29+
// var boundsR = Math.max(bounds.right - width, width);
30+
// var boundsB = Math.max(bounds.bottom - height, height);
31+
32+
if (this.scrollX < bounds.x)
2933
{
30-
this.scrollX = boundsX;
34+
this.scrollX = bounds.x;
3135
}
32-
else if (this.scrollX > boundsR)
36+
else if (this.scrollX > bounds.right)
3337
{
34-
this.scrollX = boundsR;
38+
this.scrollX = bounds.right;
3539
}
3640

37-
if (this.scrollY < boundsY)
41+
if (this.scrollY < bounds.y)
3842
{
39-
this.scrollY = boundsY;
43+
this.scrollY = bounds.y;
4044
}
41-
else if (this.scrollY > boundsB)
45+
else if (this.scrollY > bounds.bottom)
4246
{
43-
this.scrollY = boundsB;
47+
this.scrollY = bounds.bottom;
4448
}
4549
}
4650

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ var HitTest = function (tempMatrix, x, y, gameObjects, camera, output)
2929
continue;
3030
}
3131

32-
var point = GetTransformedPoint(
33-
tempMatrix,
34-
gameObject,
32+
tempMatrix.applyITRS(gameObject.x, gameObject.y, -gameObject.rotation, gameObject.scaleX, gameObject.scaleY);
33+
34+
tempMatrix.invert();
35+
36+
var point = tempMatrix.transformPoint(
3537
screenPoint.x + camera.scrollX * gameObject.scrollFactorX,
3638
screenPoint.y + camera.scrollY * gameObject.scrollFactorY
3739
);
40+
41+
// var point = GetTransformedPoint(
42+
// tempMatrix,
43+
// gameObject,
44+
// screenPoint.x + camera.scrollX * gameObject.scrollFactorX,
45+
// screenPoint.y + camera.scrollY * gameObject.scrollFactorY
46+
// );
3847

3948
if (PointWithinHitArea(gameObject, point.x, point.y, camera))
4049
{

0 commit comments

Comments
 (0)