Skip to content

Commit 3bc6eba

Browse files
committed
Removed incorrect resolution multiplication and used updated camera viewport
1 parent fb4f28b commit 3bc6eba

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/input/InputManager.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,15 +1111,20 @@ var InputManager = new Class({
11111111
if (output === undefined) { output = this._tempHitTest; }
11121112

11131113
var tempPoint = this._tempPoint;
1114-
var cameraW = camera.width;
1115-
var cameraH = camera.height;
1114+
1115+
var cx = camera._cx;
1116+
var cy = camera._cy;
1117+
var cw = camera._cw;
1118+
var ch = camera._ch;
1119+
var csx = camera.scrollX;
1120+
var csy = camera.scrollY;
11161121

11171122
output.length = 0;
11181123

11191124
var x = pointer.x;
11201125
var y = pointer.y;
11211126

1122-
if (!(x >= camera.x && y >= camera.y && x <= camera.x + cameraW && y <= camera.y + cameraH))
1127+
if (!(x >= cx && y >= cy && x <= cx + cw && y <= cy + ch))
11231128
{
11241129
return output;
11251130
}
@@ -1130,13 +1135,8 @@ var InputManager = new Class({
11301135
pointer.worldX = tempPoint.x;
11311136
pointer.worldY = tempPoint.y;
11321137

1133-
// Disable until fixed.
1134-
// var culledGameObjects = camera.cull(gameObjects);
1135-
11361138
var point = { x: 0, y: 0 };
11371139

1138-
var res = this.game.config.resolution;
1139-
11401140
var matrix = this._tempMatrix;
11411141

11421142
for (var i = 0; i < gameObjects.length; i++)
@@ -1148,8 +1148,8 @@ var InputManager = new Class({
11481148
continue;
11491149
}
11501150

1151-
var px = tempPoint.x * res + (camera.scrollX * gameObject.scrollFactorX) - camera.scrollX;
1152-
var py = tempPoint.y * res + (camera.scrollY * gameObject.scrollFactorY) - camera.scrollY;
1151+
var px = tempPoint.x + (csx * gameObject.scrollFactorX) - csx;
1152+
var py = tempPoint.y + (csy * gameObject.scrollFactorY) - csy;
11531153

11541154
if (gameObject.parentContainer)
11551155
{
@@ -1248,8 +1248,8 @@ var InputManager = new Class({
12481248
* @since 3.10.0
12491249
*
12501250
* @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for.
1251-
*
1252-
* @return {number} The translated value.
1251+
* @param {number} pageX - The Page X value.
1252+
* @param {number} pageY - The Page Y value.
12531253
*/
12541254
transformPointer: function (pointer, pageX, pageY)
12551255
{

0 commit comments

Comments
 (0)