Interface Viewport

Viewport represents the viewport in the Penpot application. It includes the center point, zoom level, and the bounds of the viewport.

interface Viewport {
    center: Point;
    zoom: number;
    bounds: Bounds;
    zoomReset(): void;
    zoomToFitAll(): void;
    zoomIntoView(shapes: Shape[]): void;
}

Properties

center: Point

the center point of the current viewport. If changed will change the viewport position.

zoom: number

the zoom level as a number where 1 represents 100%.

bounds: Bounds

the bounds are the current coordinates of the viewport.

Methods

  • Resets the zoom level.

    Returns void

  • Changes the viewport and zoom so can fit all the current shapes in the page.

    Returns void

  • Changes the viewport and zoom so all the shapes in the argument are visible.

    Parameters

    Returns void