Skip to content

Commit 89967af

Browse files
committed
Fixed Camera input resolution
1 parent a103b0e commit 89967af

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/cameras/2d/BaseCamera.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ var BaseCamera = new Class({
778778
var mve = cameraMatrix[4];
779779
var mvf = cameraMatrix[5];
780780

781-
/* First Invert Matrix */
781+
// Invert Matrix
782782
var determinant = (mva * mvd) - (mvb * mvc);
783783

784784
if (!determinant)
@@ -806,14 +806,14 @@ var BaseCamera = new Class({
806806
var scrollX = this.scrollX;
807807
var scrollY = this.scrollY;
808808

809-
var res = this.resolution;
809+
var sx = x + ((scrollX * c - scrollY * s) * zoom);
810+
var sy = y + ((scrollX * s + scrollY * c) * zoom);
810811

811-
var sx = x * res + ((scrollX * c - scrollY * s) * zoom);
812-
var sy = y * res + ((scrollX * s + scrollY * c) * zoom);
812+
// Apply transform to point
813+
var res = this.resolution;
813814

814-
/* Apply transform to point */
815-
output.x = (sx * ima + sy * imc + ime);
816-
output.y = (sx * imb + sy * imd + imf);
815+
output.x = (sx * ima + sy * imc + ime) * res;
816+
output.y = (sx * imb + sy * imd + imf) * res;
817817

818818
return output;
819819
},

src/input/InputManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ var InputManager = new Class({
11721172
{
11731173
TransformXY(px, py, gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY, point);
11741174
}
1175-
1175+
11761176
if (this.pointWithinHitArea(gameObject, point.x, point.y))
11771177
{
11781178
output.push(gameObject);

0 commit comments

Comments
 (0)