@mocanvas/editor · class

CameraStateTracker

declare class CameraStateTracker extends EditorManager

This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.


Methods · 4

constructor(editor: Editor)
getCameraState(): TLCameraState

Reactive: reading this inside a signal re-runs it when the camera stops.

getDebouncedZoomLevel(): number

The zoom level as of the last time the camera settled, or as of the last change bigger than debouncedZoomOctaves.

The threshold is what makes this useful during a *slow* movement: a pinch that crosses a whole zoom step should update the things that depend on zoom even before the user lets go, while jitter around a single value should not.

notifyCameraMoved(zoom: number): void

Tell the tracker the camera just moved. Restarts the settle timer, so the state stays "moving" for as long as moves keep arriving.

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.