diff --git a/src/js/stendhal/landscape/ParallaxBackground.ts b/src/js/stendhal/landscape/ParallaxBackground.ts index 545a882095..076d1933e1 100644 --- a/src/js/stendhal/landscape/ParallaxBackground.ts +++ b/src/js/stendhal/landscape/ParallaxBackground.ts @@ -64,9 +64,9 @@ export class ParallaxBackground { const tileLeftStart = offsetX - ((offsetX / 4) % this.image.width); let tileTop = offsetY - ((offsetY / 4) % this.image.height); - while (tileTop - offsetY < ctx.canvas.height) { + for (let yidx = 0; yidx < 100 && tileTop - offsetY < ctx.canvas.height; yidx++) { let tileLeft = tileLeftStart; - while (tileLeft - offsetX < ctx.canvas.width) { + for (let xidx = 0; xidx < 100 && tileLeft - offsetX < ctx.canvas.width; xidx++) { ctx.drawImage(this.image, tileLeft, tileTop); tileLeft += this.image.width; }