Skip to content

Commit d9a9c7a

Browse files
committed
esline tidy-up.
1 parent 4969bf3 commit d9a9c7a

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ var PointWithinGameObject = require('./PointWithinGameObject');
55
// Array contains matching Game Objects.
66
// Array will be empty if no objects were matched.
77

8-
var PointScreenToWorldHitTest = function (tempMatrix, x, y, gameObjectArray, camera, output)
8+
var PointScreenToWorldHitTest = function (tempMatrix, x, y, gameObjectArray, camera, output)
99
{
10-
var length = gameObjectArray.length;
1110
var scrollX = camera.scrollX;
1211
var scrollY = camera.scrollY;
1312
var cameraW = camera.width;
@@ -21,17 +20,25 @@ var PointScreenToWorldHitTest = function (tempMatrix, x, y, gameObjectArray, cam
2120
return output;
2221
}
2322

24-
var screenPoint = camera.cameraToScreen({x: x, y: y});
23+
var screenPoint = camera.cameraToScreen({ x: x, y: y });
24+
var object;
25+
var tpoint;
2526

2627
if (Array.isArray(gameObjectArray))
2728
{
2829
var culled = camera.cull(gameObjectArray);
2930
var culledLength = culled.length;
3031

31-
for (var index = 0; index < culledLength; ++index)
32+
for (var i = 0; i < culledLength; i++)
3233
{
33-
var object = culled[index];
34-
var tpoint = GetTransformedPoint(tempMatrix, object, screenPoint.x + scrollX * object.scrollFactorX, screenPoint.y + scrollY * object.scrollFactorY);
34+
object = culled[i];
35+
36+
tpoint = GetTransformedPoint(
37+
tempMatrix,
38+
object,
39+
screenPoint.x + scrollX * object.scrollFactorX,
40+
screenPoint.y + scrollY * object.scrollFactorY
41+
);
3542

3643
if (PointWithinGameObject(object, tpoint.x, tpoint.y))
3744
{
@@ -41,9 +48,14 @@ var PointScreenToWorldHitTest = function (tempMatrix, x, y, gameObjectArray, cam
4148
}
4249
else
4350
{
44-
var object = gameObjectArray;
51+
object = gameObjectArray;
4552

46-
var tpoint = GetTransformedPoint(tempMatrix, object, screenPoint.x + scrollX * object.scrollFactorX, screenPoint.y + scrollY * object.scrollFactorY);
53+
tpoint = GetTransformedPoint(
54+
tempMatrix,
55+
object,
56+
screenPoint.x + scrollX * object.scrollFactorX,
57+
screenPoint.y + scrollY * object.scrollFactorY
58+
);
4759

4860
if (PointWithinGameObject(object, tpoint.x, tpoint.y))
4961
{

0 commit comments

Comments
 (0)