Skip to content
EliteChart

FloatingToolbarBinding

Documentation


Documentation / @elitechart/core / FloatingToolbarBinding

Defined in: ui/floating-toolbar.ts:48

Actions the toolbar delegates back to the chart. The chart supplies a fresh binding every time a new drawing is selected so the toolbar stays ignorant of drawing ids.

Example

code
const binding: FloatingToolbarBinding = {
  style: drawing.style,
  alpha: 1,
  locked: false,
  setColor: (hex, a) => chart.setDrawingStyle(id, { color: hexToRgba(hex, a) }),
  setLineStyle: (s) => chart.setDrawingStyle(id, { lineStyle: s }),
  setLineWidth: (w) => chart.setDrawingStyle(id, { lineWidth: w }),
  setLocked: (l) => chart.setDrawingLocked(id, l),
  remove: () => chart.removeDrawing(id),
  duplicate: () => chart.duplicateDrawing(id),
  bringToFront: () => chart.bringDrawingToFront(id),
  sendToBack: () => chart.sendDrawingToBack(id),
};

Properties

alpha

code
readonly alpha: number;

Defined in: ui/floating-toolbar.ts:52

Current opacity (0–1) — distilled from style.color or default 1.


locked

code
readonly locked: boolean;

Defined in: ui/floating-toolbar.ts:54

Current lock state.


style

code
readonly style: DrawingStyle;

Defined in: ui/floating-toolbar.ts:50

Current resolved style for the selected drawing.

Methods

bringToFront()

code
bringToFront(): void;

Defined in: ui/floating-toolbar.ts:61

Returns

void


duplicate()

code
duplicate(): void;

Defined in: ui/floating-toolbar.ts:60

Returns

void


remove()

code
remove(): void;

Defined in: ui/floating-toolbar.ts:59

Returns

void


sendToBack()

code
sendToBack(): void;

Defined in: ui/floating-toolbar.ts:62

Returns

void


setColor()

code
setColor(hex, alpha): void;

Defined in: ui/floating-toolbar.ts:55

Parameters

hex

string

alpha

number

Returns

void


setLineStyle()

code
setLineStyle(style): void;

Defined in: ui/floating-toolbar.ts:56

Parameters

style

LineStyle

Returns

void


setLineWidth()

code
setLineWidth(width): void;

Defined in: ui/floating-toolbar.ts:57

Parameters

width

number

Returns

void


setLocked()

code
setLocked(locked): void;

Defined in: ui/floating-toolbar.ts:58

Parameters

locked

boolean

Returns

void