weasel API - v0.8.0
    Preparing search index...

    Interface OngoingHandle

    Handle returned from an OngoingInvoker.start. The dispatcher pumps onMove on subsequent input events of the same gesture and calls onEnd exactly once (with 'commit' on natural completion or 'cancel' on pointercancel / blur / escape).

    interface OngoingHandle {
        kind?: string;
        previewHidesSource?: boolean;
        onEnd?(ctx: InvocationCtx, reason: "commit" | "cancel"): void;
        onMove?(ctx: InvocationCtx): void;
        overlay?(): OngoingOverlay | null;
        previewData?(id: string): unknown;
        previewIds?(): Iterable<string, any, any> | null;
        previewPose?(id: string): unknown;
    }
    Index

    Properties

    kind?: string

    Optional logical action kind — a stable, human-readable tag the dispatcher exposes via getActiveAction() for chrome-visibility rules and any other surface that wants to react to "what action is currently in flight" without inspecting handles directly.

    Examples: 'marquee', 'lasso', 'move', 'resize', 'rotate', 'pan', 'pinch'.

    Distinct from the dispatcher's internal gestureId (pointer-mouse, key-held-Space, etc.) which keys per-pointer state and is not meaningful to consumers.

    When omitted, the action is "anonymous" — getActiveAction().kind reports null even though a handle is in flight. This is fine for actions that don't have visible chrome of their own.

    previewHidesSource?: boolean

    When false, the preview-ghost layer paints the ghost AND the source node stays visible at its committed pose. Defaults to true (move/resize/rotate semantics: ghost replaces the source during the gesture). Clone overrides to false so the original stays put and the ghost appears at the drag target.

    Methods

    • Optional chrome surface — dispatcher-side overlay layer.

      An ongoing-action implementation may populate overlay() to expose a non-ghost visual (marquee rectangle, lasso polyline) for the canvas's useDispatcherOverlayLayer to paint while the gesture is in flight. Returning null (or omitting the method) means "no overlay this gesture" — the canvas will skip this handle as a chrome source.

      Distinct from the previewIds()/previewPose(id) ghost surface, which paints displaced scene-node silhouettes. Marquee and lasso gestures don't displace any node, but still need on-screen feedback.

      Returns OngoingOverlay | null

    • Optional per-id preview data. Falls back to the committed node.data when null/absent. Use when the gesture mutates node.data (e.g. anchor-edit on nodes that store the polygon on data.path) rather than (or in addition to) the pose. The preview- ghost layer assembles a synthetic node from { ...node, pose: previewPose ?? node.pose, data: previewData ?? node.data } before calling the scene slot's drawOne.

      Sources compose first-non-null per axis: an action can emit only previewPose (translation), only previewData (data-only edit), or both (pose + data both change, e.g. anchor drag on a data.path node where the bounds shift).

      Parameters

      • id: string

      Returns unknown

    • Optional preview surface — dispatcher-side ghost overlay.

      An ongoing-action implementation may populate previewIds() + previewPose(id) to expose its in-flight preview state for the canvas's preview-ghost layer (usePreviewGhostLayer) to render on top of the committed scene during the gesture.

      Returning null (or omitting the method entirely) means "no preview this gesture" — the canvas will skip this handle as a source.

      Semantics mirror the tool-side Tool.previewIds / Tool.previewPose pair: previewIds() enumerates the displaced node ids; previewPose(id) returns the interim pose for one of those ids (shape opaque — the canvas casts to its TPose parameter). The preview-ghost layer merges all sources via first-non-null semantics, with tool-side previews taking precedence over dispatcher-side (preserves backwards-compat during the registry-unification migration).

      Returns Iterable<string, any, any> | null