@mocanvas/editor · interface

TLCameraOptions

interface TLCameraOptions

Camera configuration, held on the editor and reachable through Editor.getCameraOptions() / Editor.setCameraOptions().

This is the whole of the camera's policy: whether the user may move it, what the wheel does, how fast panning and zooming feel, which zoom levels the zoom-in/zoom-out steps land on, and — optionally — a region the camera is kept inside of.


Properties · 6

constraints?: TLCameraConstraints

Keeps the camera over a fixed region. Absent means an unbounded canvas.

isLocked: boolean

When true the camera ignores user input; programmatic moves need force.

panSpeed: number

Multiplier applied to pan deltas.

wheelBehavior: "zoom" | "pan" | "none"

What an unmodified wheel gesture does. Ctrl/meta always zooms.

zoomSpeed: number

Multiplier applied to zoom deltas.

zoomSteps: number[]

The zoom levels zoomIn() / zoomOut() step between, ascending. They are multiples of Editor.getBaseZoom(), so with constraints in play the same steps mean the same thing at any viewport size.

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.