From 879e68d70db42739f9f26ab73a5bf4a220c39f34 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Fri, 6 May 2022 12:51:24 +0200 Subject: [PATCH] fixed CanvasKeyValueIterator loop --- src/lib/ui/Canvas.hx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/ui/Canvas.hx b/src/lib/ui/Canvas.hx index 52e913b..a8f8775 100644 --- a/src/lib/ui/Canvas.hx +++ b/src/lib/ui/Canvas.hx @@ -106,18 +106,22 @@ class CanvasKeyValueIterator { return null; } - for (y in (this.index.y)...(this.canvas.length)){ + var startX = this.index.x + 1; + + for (y in this.index.y...this.canvas.length){ if (this.canvas[y] == null) { continue; } - for (x in (this.index.x + 1)...(this.canvas[y].length)){ + for (x in startX...(this.canvas[y].length)){ if (this.canvas[y][x] == null) { continue; } return {x: x, y: y}; } + + startX = 0; } return null; }