Camera.preRender will no longer round the origin, follow coordinates or scrollX/Y coordinates. It will still round the World view.

This commit is contained in:
Richard Davey 2023-11-07 18:31:48 +00:00
parent df846bdab3
commit 7590600b5e

View file

@ -516,12 +516,6 @@ var Camera = new Class({
var emitFollowEvent = false;
if (this.roundPixels)
{
originX = Math.floor(originX);
originY = Math.floor(originY);
}
if (follow && !this.panEffect.isRunning)
{
var lerp = this.lerp;
@ -529,12 +523,6 @@ var Camera = new Class({
var fx = follow.x - this.followOffset.x;
var fy = follow.y - this.followOffset.y;
if (this.roundPixels)
{
fx = Math.floor(fx);
fy = Math.floor(fy);
}
if (deadzone)
{
if (fx < deadzone.x)
@ -570,12 +558,6 @@ var Camera = new Class({
sy = this.clampY(sy);
}
if (this.roundPixels)
{
sx = Math.floor(sx);
sy = Math.floor(sy);
}
// Values are in pixels and not impacted by zooming the Camera
this.scrollX = sx;
this.scrollY = sy;
@ -590,18 +572,13 @@ var Camera = new Class({
var displayWidth = width / zoom;
var displayHeight = height / zoom;
var vwx = midX - (displayWidth / 2);
var vwy = midY - (displayHeight / 2);
if (this.roundPixels)
{
vwx = Math.floor(vwx);
vwy = Math.floor(vwy);
}
var vwx = Math.floor(midX - (displayWidth / 2));
var vwy = Math.floor(midY - (displayHeight / 2));
this.worldView.setTo(vwx, vwy, displayWidth, displayHeight);
matrix.applyITRS(Math.floor(this.x + originX), Math.floor(this.y + originY), this.rotation, zoom, zoom);
matrix.translate(-originX, -originY);
this.shakeEffect.preRender();