Pixso Open Documentation
guide
  • 中文
  • English
guide
  • 中文
  • English
  • Plugin API

    • Brief Introduction
    • Prerequisites
    • manifest
    • Development Guide
    • Change Log
    • Plugin API Documentation

      • Overview
      • Global Object

        • pixso
        • pixso.ui
        • pixso.host
        • pixso.mouse
        • pixso.editor
        • pixso.keyboard
        • pixso.fieldset
        • pixso.viewport
        • pixso.vectorEditor
        • pixso.clientStorage
        • pixso.serverStorage
      • Node Types

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • FrameNode
        • GroupNode
        • InstanceNode
        • LineNode
        • PageNode
        • PolygonNode
        • RectangleNode
        • SectionNode
        • SliceNode
        • StarNode
        • TextNode
        • VectorNode
      • Data Types

        • Action
        • ArcData
        • BlendMode
        • CommandItem
        • ComponentProperties-Related
        • Constraints
        • DialogType
        • DocumentationLink
        • Effect
        • EmbedData
        • ExportSettings
        • FontName
        • Guide
        • HandleMirroring
        • HyperlinkTarget
        • Image
        • LayoutGrid
        • LetterSpacing
        • Library
        • LineHeight
        • NodeChangeProperty
        • OverflowDirection
        • Overlay
        • Paint
        • PublishStatus
        • Reaction
        • Rect-related
        • RGB & RGBA
        • StrokeCap
        • StrokeJoin
        • StyleChangeProperty
        • TextCase
        • TextDecoration
        • TextListOptions
        • ThemeType
        • ToolType
        • Transition
        • Trigger
        • Vector
    • Host API Documentation

      • Overview
      • Host API
  • Open API

    • OpenAPI Doc

pixso.viewport

These are methods and properties available on the pixso.viewport global object. It represents the area of the canvas that is currently visible on-screen, commonly referred to as the viewport. The position of the viewport is represented via its center coordinate and zoom level.

  • Type:
interface ViewportAPI {
  center: Vector;
  zoom: number;
  scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void;
  readonly bounds: Rect;
}

center

  • Type: Vector
interface Vector {
  readonly x: number;
  readonly y: number;
}

Center of the the current page that is currently visible on screen.

zoom

  • Type: number

Zoom level. A value of 1.0 means 100% zoom, 0.5 means 50% zoom.

scrollAndZoomIntoView

  • Type: scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void

Automatically sets the viewport coordinates such that the nodes are visible on screen. It is the equivalent of pressing Shift-2.

position

  • Readonly: true
  • Type: Vector

Gets the position of the upper left corner of the current canvas in the browser coordinate system.

bounds

  • Readonly:true
  • Type: Rect
interface Rect {
  readonly x: number;
  readonly y: number;
  readonly width: number;
  readonly height: number;
}

The bounds of the viewport of the page that is currently visible on screen. The (x, y) corresponds to the top-left of the screen. User actions such as resizing the window or showing/hiding the rulers/UI will change the bounds of the viewport.

Prev
pixso.fieldset
Next
pixso.vectorEditor