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; }