Skip to main content
A live preview of one document on one surface. Created by FileFormat.view; disposed when its surface closes.

Methods

draw

Draws the current frame into a viewport of width by height.

measure

Pane surfaces only: the content’s intrinsic size for the given viewport, driving the pane’s scrollbars. Called when the view is created, the document changes, the viewport resizes, or requestDraw fires. Omit for fit-to-viewport views; the inspector never measures.

advance

Advances animation state. Return true to keep receiving frames.

textScrolled

The user scrolled the text editor. x/y are scroll percentages and line is the fractional top visible line. Never fired for scrolls the host performed on the view’s behalf (scrollEditorTo), so handlers can follow without echo bookkeeping.

paneScrolled

The user scrolled the preview pane (measured views only). x/y are the new offsets in content coordinates. Never fired for scrolls the host applied from editor:scrollTo.

paneWheel

Raw wheel/trackpad input over an unmeasured (self-scrolling) preview, in pixels with positive y scrolling down. Implement to route pane input into the view’s own scrolling; without it the host falls back to scrolling the paired text editor.

pointerDown

Pointer input over the preview surface, in the same coordinate space draw receives. Signatures match the Layout protocol so live artboards can forward events directly (board:pointerDown(event), …).

pointerMove

pointerUp

documentChanged

Text documents only: the document changed; refresh derived state.

selectionChanged

Text documents only: the primary cursor moved. line and column are zero based code point coordinates.

dispose

The surface is closing; release resources.