Skip to main content

Viewport

Represents the camera position and zoom level.

ZoomRange

Functions

createViewport

Returns a viewport at the origin with zoom 1.

screenToPage

Converts screen (pixel) coordinates to page (world) coordinates.

pageToScreen

Converts page coordinates to screen coordinates.

setViewport

Returns a new viewport with the specified properties merged in.

panViewport

Returns a new viewport translated by the given deltas.

zoomViewport

Returns a new viewport zoomed by the given factor, centered on the given screen point.

clampZoom

Clamps the viewport zoom to the given range.

Camera pan session

Camera slide

Creates a momentum-based slide animation that decelerates over time.