Skip to content

Interface: PencilSurfaceOptions

Defined in: stroke-types.ts:100

Properties

background?

optional background?: () => string | undefined

Defined in: stroke-types.ts:133

Opaque paper behind the ink, painted destination-over after the replay — so erased areas read as PAPER, not as holes. Unset (the default) keeps the canvas transparent, which the overlay use case requires: its ink floats over a live page. Set it when the surface IS the page (the scratchpad), and especially when it is captured: captureStream drops alpha, so a transparent canvas streams as ink-on-black.

Returns

string | undefined


className?

optional className?: string

Defined in: stroke-types.ts:152


fadeCurve?

optional fadeCurve?: () => "warp" | "crossfade"

Defined in: stroke-types.ts:116

Which exit a fading stroke takes. "warp" (default) is the gesture curve — hold, charge, pop: a stroke ANNOUNCING its death. "crossfade" is the remote preview's handoff (D3): a gentle dissolve that hides the moment the video's copy takes over — width never stretches, so the preview never warps away from the truth beneath it, and the baked tile is reused throughout.

Returns

"warp" | "crossfade"


fadeSec?

optional fadeSec?: () => number

Defined in: stroke-types.ts:108

Vanishing-ink lifetime, seconds. 0 (default) persists until cleared.

Returns

number


localInput?

optional localInput?: boolean

Defined in: stroke-types.ts:118

Capture local pointer input. Default true.


minCommitPoints?

optional minCommitPoints?: number

Defined in: stroke-types.ts:122

Minimum committed points. Default 1 (a tap is a dot). The overlay passes 2.


onAutoClear?

optional onAutoClear?: () => void

Defined in: stroke-types.ts:151

Every stroke faded away on its own; nothing is left.

Returns

void


onRemoteStrokeEnd?

optional onRemoteStrokeEnd?: (stroke) => void

Defined in: stroke-types.ts:149

A REMOTE stroke completed — the iPad's pen, fed through remote*.

Parameters

stroke

StrokeEnd

Returns

void


onStrokeEnd?

optional onStrokeEnd?: (stroke) => void

Defined in: stroke-types.ts:147

Parameters

stroke

StrokeEnd

Returns

void


onStrokeStart?

optional onStrokeStart?: (id, tool) => void

Defined in: stroke-types.ts:146

Parameters

id

string

tool

Tool

Returns

void


params

params: () => PencilParams

Defined in: stroke-types.ts:104

The instrument, read per stroke-start (so a stroke keeps the brush it began with).

Returns

PencilParams


resize?

optional resize?: "keep" | "rescale"

Defined in: stroke-types.ts:145

What happens to the ink when the canvas changes size (D4).

"keep" (default): strokes stay at their absolute canvas coordinates — the overlay's posture, where a resize means the page reflowed and the app is expected to retire the ink anyway (PencilSurface.clearAnimated). "rescale": the drawing re-bakes proportionally — the scratchpad's posture, where the plane is a component and nothing reflows inside a canvas. Stroke width scales by the geometric mean of the two axes, so the drawing reads as the same drawing, larger or smaller.


retention?

optional retention?: () => number

Defined in: stroke-types.ts:124

How many strokes stay individually addressable: the undo depth. Read per commit.

Returns

number


shouldCapture?

optional shouldCapture?: (e) => boolean

Defined in: stroke-types.ts:120

Per-pointerdown veto (the overlay passes !e.shiftKey — shift is inspect).

Parameters

e

PointerEvent

Returns

boolean


target?

optional target?: HTMLElement

Defined in: stroke-types.ts:102

Where to append the canvas. Defaults to document.body.


tool?

optional tool?: () => Tool

Defined in: stroke-types.ts:106

Draw or erase, read per stroke-start.

Returns

Tool