fix: math

This commit is contained in:
cha0s 2022-04-13 15:31:02 -05:00
parent 77c7778332
commit a296424105

View File

@ -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];