Skip to main content

Canvas Coordinates

Reactodia uses different coordinate systems when dealing with infinitely-resizable and scalable canvas content.

Coordinate types

TypeDescription
paperMain coordinates system for diagram content (elements, links, etc) — unlimited in size, always in 1:1 scale with element and link templates.
scrollable paneRepresents scaled but still unlimited in size layer, natively scrolled inside viewport container.
It is possible to use totalPaneSize() and paneTopLeft() to get current pane bounds with the same coordinates type.
client (viewport)Represents fixed-size "window" into visible graph area, equal to DOM client coordinates for the Canvas component.
pageSame as DOM page coordinates — generally used when handling pointer-related events.

Reactodia coordinate system

Converting coordinates from/to different types

From typeTo typeMethod
paperscrollable panepaperToScrollablePaneCoords()
pagepaperToPageCoords()
scrollable panepaperscrollablePaneToPaperCoords()
client (viewport)scrollablePaneToClientCoords()
client (viewport)paperclientToPaperCoords()
scrollable paneclientToScrollablePaneCoords()
pagepaperpageToPaperCoords()