Skip to content

charton API


charton API / @chart-on/ui / index / placeToolbar

Function: placeToolbar() ​

placeToolbar(rect, size, area): object

Defined in: ui/src/drawing-toolbar.ts:39

Where to put a toolbar of size next to the selection rect inside an area of area (all css px). It tries, in order: centered above the selection, below it, to its right, to its left. The first side with room keeps the toolbar outside the selection box, so it never covers an anchor. Only when no side has room does it fall back to below the selection, clamped into the area. area.top keeps a band at the top of the area clear, for a strip floating there (the replay controls); when the toolbar does not fit below the band, it overlaps the band rather than leave the area.

Parameters ​

rect ​

Rect

size ​

height ​

number

width ​

number

area ​

height ​

number

top? ​

number

width ​

number

Returns ​

object

x ​

x: number

y ​

y: number