From a296424105dbee466fcb95e473966d10c1fa68cb Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 13 Apr 2022 15:31:02 -0500 Subject: [PATCH] fix: math --- packages/topdown/src/renderable/tiles.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/topdown/src/renderable/tiles.js b/packages/topdown/src/renderable/tiles.js index b0e8655..e99e926 100644 --- a/packages/topdown/src/renderable/tiles.js +++ b/packages/topdown/src/renderable/tiles.js @@ -114,8 +114,8 @@ export default class TilesView extends Container { return; } const [sw, sh] = [ - cx + cw > fw ? (cx + cw) - fw : cw, - cy + ch > fh ? (cy + ch) - fh : ch, + cx + cw > fw ? cx - ((cx + cw) - fw) : cw, + cy + ch > fh ? cy - ((cy + ch) - fh) : ch, ]; const [tw, th] = this.tiles.tileSize; const slice = this.tiles.slice([cx - 1, cy - 1, sw + 2, sh + 2]); @@ -125,7 +125,7 @@ export default class TilesView extends Container { container.mask = mask; mask.anchor = [0, 0]; } - const rw = (cw + 2) * tw; + const rw = (sw + 2) * tw; let [x, y] = [0, 0]; for (let i = 0; i < slice.length; ++i) { const index = slice[i];