Skip to content

API reference / edit-controls / EditControlAction

Interface: EditControlAction ​

Defined in: tacticalgraphics/ui/editControls.ts:57

A button of your own on the selection box, pressed rather than dragged.

Properties ​

corner? ​

ts
optional corner?: EditControlCorner;

Defined in: tacticalgraphics/ui/editControls.ts:65

Which corner of the box it hangs from. Default bottom-left, the one the gestures leave free.


icon ​

ts
icon: string | Element;

Defined in: tacticalgraphics/ui/editControls.ts:63

The picture: SVG or HTML markup as a string, or an element, which is moved into the button.


id ​

ts
id: string;

Defined in: tacticalgraphics/ui/editControls.ts:59

Names the button: it gets the class tg-edit-button--<id>.


label ​

ts
label: string;

Defined in: tacticalgraphics/ui/editControls.ts:61

The tooltip, and the name screen readers read.

Methods ​

onPress() ​

ts
onPress(graphic): void;

Defined in: tacticalgraphics/ui/editControls.ts:74

Called when the button is pressed, with the selected graphic (null from an engine without getSelection).

Parameters ​

graphic ​

| SelectedGraphic | null

Returns ​

void


visible()? ​

ts
optional visible(graphic): boolean;

Defined in: tacticalgraphics/ui/editControls.ts:72

Whether to show the button for this graphic. Default: for every graphic. Asked whenever the selection changes, so a button can belong to one kind of graphic only: visible: graphic => graphic.name === TacticalGraphicName.WeaponSensorRangeFanCircular. An engine without getSelection shows the button for every graphic.

Parameters ​

graphic ​

SelectedGraphic

Returns ​

boolean

Released under the MIT License.