Interface DrawingControllerOptions

interface DrawingControllerOptions {
    clipboard?: null | ClipboardPort;
    clipboardFallbackToMemory?: boolean;
    defaultStyle?: DrawingStyle;
    historyLimit?: number;
    magnet?: boolean | MagnetMode;
    pasteOffsetBars?: number;
    pasteOffsetPixels?: number;
    stayInDrawingMode?: boolean;
}

Properties

clipboard?: null | ClipboardPort

Where copy and paste move text. Defaults to navigator.clipboard; pass a port to route through a host's own transfer, or null to stay in the process-local clipboard entirely.

clipboardFallbackToMemory?: boolean

Whether a refused or failing clipboard write still lands in the in-process clipboard. Defaults to true, which is what makes copy and paste work between two charts on a page where the browser has denied clipboard permission.

Pass false for a host that would rather a failed copy be a failed copy: with it off, cut leaves the drawing alone when the write does not land, so a shape is never destroyed for a transfer that did not happen.

defaultStyle?: DrawingStyle

Style merged under every tool's own defaults.

historyLimit?: number

Undo depth. Default 50.

magnet?: boolean | MagnetMode

Snap new anchors to the O/H/L/C of the bar under the cursor. 'strong' always takes the nearest of the four; 'weak' only when one sits within a few pixels of the pointer, so a click on open space stays where it was made. true means 'strong' and false means 'off', which is what the boolean meant before the modes existed. Default 'off'. While a tool is armed the layer paints a ring where the next click will land.

pasteOffsetBars?: number

How far a pasted or duplicated copy lands from its original, in bars along time and in screen pixels down the price axis. A copy that lands exactly on top of the original reads as nothing having happened. Defaults: 2 bars, 16 px.

pasteOffsetPixels?: number
stayInDrawingMode?: boolean

Stay in the active tool after finishing a drawing. Default false.