fix tiling

This commit is contained in:
Azgaar 2021-06-24 23:34:27 +03:00
parent e923cf06c9
commit e767b1b54b
2 changed files with 10 additions and 6 deletions

View file

@ -106,8 +106,8 @@ async function saveTiles() {
const img = new Image();
img.src = url;
img.onload = function () {
for (let y = 0, i = 0; y < graphHeight; y += tileH) {
for (let x = 0; x < graphWidth; x += tileW, i++) {
for (let y = 0, i = 0; y + tileH <= graphHeight; y += tileH) {
for (let x = 0; x + tileW <= graphWidth; x += tileW, i++) {
ctx.drawImage(img, x, y, tileW, tileH, 0, 0, canvas.width, canvas.height);
const name = `fmg_tile_${i}.png`;
canvas.toBlob(blob => {