Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pavle Goloskokovic 2018-01-04 15:58:46 +01:00
commit 56dab0e0eb
2 changed files with 28 additions and 15 deletions

View file

@ -20,27 +20,31 @@ var PreRender = function ()
if (this.useBounds) if (this.useBounds)
{ {
var bounds = this._bounds; var bounds = this._bounds;
var boundsX = bounds.x;
var boundsY = bounds.y;
var boundsR = Math.max(bounds.right - width, width);
var boundsB = Math.max(bounds.bottom - height, height);
if (this.scrollX < boundsX) // width = bounds.width;
// height = bounds.height;
// var boundsX = bounds.x;
// var boundsY = bounds.y;
// var boundsR = Math.max(bounds.right - width, width);
// var boundsB = Math.max(bounds.bottom - height, height);
if (this.scrollX < bounds.x)
{ {
this.scrollX = boundsX; this.scrollX = bounds.x;
} }
else if (this.scrollX > boundsR) else if (this.scrollX > bounds.right)
{ {
this.scrollX = boundsR; this.scrollX = bounds.right;
} }
if (this.scrollY < boundsY) if (this.scrollY < bounds.y)
{ {
this.scrollY = boundsY; this.scrollY = bounds.y;
} }
else if (this.scrollY > boundsB) else if (this.scrollY > bounds.bottom)
{ {
this.scrollY = boundsB; this.scrollY = bounds.bottom;
} }
} }

View file

@ -29,13 +29,22 @@ var HitTest = function (tempMatrix, x, y, gameObjects, camera, output)
continue; continue;
} }
var point = GetTransformedPoint( tempMatrix.applyITRS(gameObject.x, gameObject.y, -gameObject.rotation, gameObject.scaleX, gameObject.scaleY);
tempMatrix,
gameObject, tempMatrix.invert();
var point = tempMatrix.transformPoint(
screenPoint.x + camera.scrollX * gameObject.scrollFactorX, screenPoint.x + camera.scrollX * gameObject.scrollFactorX,
screenPoint.y + camera.scrollY * gameObject.scrollFactorY screenPoint.y + camera.scrollY * gameObject.scrollFactorY
); );
// var point = GetTransformedPoint(
// tempMatrix,
// gameObject,
// screenPoint.x + camera.scrollX * gameObject.scrollFactorX,
// screenPoint.y + camera.scrollY * gameObject.scrollFactorY
// );
if (PointWithinHitArea(gameObject, point.x, point.y, camera)) if (PointWithinHitArea(gameObject, point.x, point.y, camera))
{ {
output.push(gameObject); output.push(gameObject);