Don't round the midPoint, or it breaks high zoom scrolling. Fix #6878

This commit is contained in:
Richard Davey 2024-08-06 23:01:33 +01:00
parent 5aaa5ec601
commit 6acd415d16
No known key found for this signature in database

View file

@ -555,8 +555,8 @@ var Camera = new Class({
if (this.roundPixels) if (this.roundPixels)
{ {
sx = Math.floor(sx + 0.5); sx = Math.floor(sx);
sy = Math.floor(sy + 0.5); sy = Math.floor(sy);
} }
if (this.useBounds) if (this.useBounds)
@ -569,8 +569,9 @@ var Camera = new Class({
this.scrollX = sx; this.scrollX = sx;
this.scrollY = sy; this.scrollY = sy;
var midX = Math.floor((sx + halfWidth) + 0.5); // Don't round the midPoint, otherwise it breaks things like smooth zoom
var midY = Math.floor((sy + halfHeight) + 0.5); var midX = sx + halfWidth;
var midY = sy + halfHeight;
// The center of the camera, in world space, so taking zoom into account // The center of the camera, in world space, so taking zoom into account
// Basically the pixel value of what it's looking at in the middle of the cam // Basically the pixel value of what it's looking at in the middle of the cam
@ -584,7 +585,11 @@ var Camera = new Class({
this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); this.worldView.setTo(vwx, vwy, displayWidth, displayHeight);
matrix.applyITRS(Math.floor(this.x + originX + 0.5), Math.floor(this.y + originY + 0.5), this.rotation, zoomX, zoomY); matrix.applyITRS(
Math.floor(this.x + originX + 0.5),
Math.floor(this.y + originY + 0.5),
this.rotation,
zoomX, zoomY);
matrix.translate(-originX, -originY); matrix.translate(-originX, -originY);