@mocanvas/editor · function

getCurrentPageShapesInReadingOrder

declare function getCurrentPageShapesInReadingOrder(editor: Editor): UnknownShape[]

The current page's shapes in READING order: top to bottom, then left to right, the way a person scans a board.

Paint order is the wrong order for a screen reader, for tab navigation and for "next shape" keyboard movement — it is an implementation detail of z-stacking, and a shape moved to the front does not become the first thing you should hear about. Reading order is stable under z-order changes.

SEMANTICS-ASSUMED: rows are banded. Two shapes whose vertical centres are within half the shorter one's height count as being on the same line and are ordered left to right; otherwise the higher one comes first. Without a band a row of cards laid out a pixel apart vertically reads as a column.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.