Constructors

Methods

  • Over the series (zIndex 0). A no-op for a drawing already there.

    Parameters

    • id: string

    Returns void

  • In front of every other drawing on its pane. Stays on its side of the series.

    Parameters

    • id: string

    Returns void

  • Abandon whatever is being placed: the anchors so far are dropped and, unless the controller stays in drawing mode, the tool is disarmed too, so one Escape returns the chart to the cursor the way a finished shape would. With nothing pending, an armed tool is simply disarmed. Returns whether anything changed, so a host can let the key fall through when it did nothing.

    Returns boolean

  • Put drawings on the clipboard. Defaults to the selection; pass an id or a list of ids to copy something else. Resolves false when there was nothing to copy, or when the payload could not be stored anywhere.

    Parameters

    • Optionaltarget: null | string | readonly string[]

    Returns Promise<boolean>

  • Copy, then delete. The delete happens only after the clipboard write resolves successfully, so a refused write leaves the model exactly as it was rather than destroying a drawing that went nowhere.

    Parameters

    • Optionaltarget: null | string | readonly string[]

    Returns Promise<boolean>

  • Every drawing, in list order. That is creation order until a z-order call moves one; the list is the tie-break for equal zIndex, so it is also the paint order within a band.

    Returns readonly Drawing[]

  • Clone drawings, offset like a paste so the copies are visibly new, and select the clones. One undo entry. Ids that name nothing are ignored.

    Parameters

    • ids: readonly string[]

    Returns Drawing[]

  • End a variable-anchor shape (polyline, path) at the anchors placed so far. Those tools declare points: 0, so nothing else can ever complete them; without this they collected vertices forever. Bound to double-click, and public so a host can offer Esc / Enter too. No-op when there is nothing placeable, so a stray double-click costs nothing.

    Returns boolean

  • Replace every drawing. Accepts a DrawingsDocument or a 1.9.x bare Drawing[]; both go through the migration, so an old save upgrades on load. Clears the selection and history.

    Parameters

    • data: unknown

    Returns void

  • The drawing under the pointer, selected or not, as the chart's hit-test last reported it. What a host passes as hasTarget to the key mapping, and what a context menu opens on.

    Returns null | string

  • Move drawings by a screen distance, dx right and dy down in media px, as one undo entry. Pixels rather than data units so an arrow key moves a shape the same visible amount on every pane and scale. Locked drawings stay put.

    Parameters

    • ids: readonly string[]
    • dxPx: number
    • dyPx: number

    Returns void

  • Paste whatever is on the clipboard into this chart, offset from the original so the copy is visibly a second object, and select the result. Each pasted drawing is a fresh object with a fresh id, never a second reference to the one copied, so editing the paste cannot alter its source (or the clipboard).

    Anything that is not our payload (foreign text, a truncated or hand-edited copy, a newer format) pastes nothing and resolves to an empty array: a paste shortcut must not throw at the host because the user last copied a spreadsheet cell.

    Returns Promise<Drawing[]>

  • Remove the last anchor placed on a variable-anchor tool (polyline, path) still being drawn: the Backspace of placement. A fixed-anchor tool has nothing to pop, since its anchors commit the moment the last one lands, and a freehand stroke is one gesture rather than a list. Returns whether an anchor went.

    Returns boolean

  • Delete several drawings as one undo entry. Unknown ids are ignored.

    Parameters

    • ids: readonly string[]

    Returns void

  • Replace the selection, or with additive toggle each id into it (the shift-click gesture). Ids that name nothing are ignored, so the selection never refers to a drawing that is not there. Pass null to clear.

    Parameters

    • id: null | string | readonly string[]
    • additive: boolean = false

    Returns void

  • The primary selection: the first id picked, or null.

    Returns null | string

  • Every selected id, in the order they were picked.

    Returns readonly string[]

  • Under the series (zIndex -1). A no-op for a drawing already there.

    Parameters

    • id: string

    Returns void

  • Behind every other drawing on its pane. Stays on its side of the series.

    Parameters

    • id: string

    Returns void

  • Arm a tool for placement, or pass null to return to the cursor.

    Parameters

    • toolId: null | string

    Returns void

  • Parameters

    • id: string
    • patch: Partial<
          Pick<
              Drawing,
              "style"
              | "text"
              | "visible"
              | "locked"
              | "props"
              | "zIndex"
              | "points",
          >,
      >

    Returns boolean

  • Patch several drawings as one undo entry: a colour change across a multi-selection is one edit to the user, so it is one Ctrl+Z too. Ids that no longer exist are skipped; nothing is recorded when none exist.

    Parameters

    • patches: readonly {
          id: string;
          patch: Partial<
              Pick<
                  Drawing,
                  "style"
                  | "text"
                  | "visible"
                  | "locked"
                  | "props"
                  | "zIndex"
                  | "points",
              >,
          >;
      }[]

    Returns void