@mocanvas/editor · type

TLCameraConstraintsZoom

type TLCameraConstraintsZoom = "default" | "fit-x" | "fit-y" | "fit-min" | "fit-max"

How a zoom level is derived from the constraint bounds and the viewport.

SEMANTICS-ASSUMED: the fit-min / fit-max names appear in the notes without a definition. Read as "fit the minimum / maximum dimension": fitting the SMALLER dimension means the bounds covers the viewport and may overflow on the other axis, fitting the LARGER one means all of it is visible. That is the cover/contain pair, which is the only reading in which both names do useful and different work.

- default — no fitting; the level is 1. - fit-x / fit-y — the bounds' width / height exactly spans the viewport. - fit-max — CONTAIN: the larger dimension is the one that just fits, so all of the bounds is visible. - fit-min — COVER: the smaller dimension is the one that just fits, so the bounds fills the viewport and may overflow on the other axis.

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.