Skip to content

@fabwcie/free-drawing / utils/shapeNavigation

utils/shapeNavigation ​

Classes ​

ShapeNavigation ​

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:30

Keyboard navigation between the shapes of the drawing, with the focus on the drawer itself (not on its buttons or fields): Enter reaches the first shape, Tab / Shift + Tab the next / previous one in reading order among the shapes of the same drawing, frame or group (around at the end), Enter the shapes of a group or frame (or edits a text), Shift + Enter the group or frame of the shape, Escape leaves the shapes (then Tab goes to the interface). The shape reached is selected (outlined in read only: no selection there), shown in the view and described to screen readers: name, type, text, shapes inside, ends of an arrow, link, locked, number among its shapes

Constructors ​

Constructor ​

new ShapeNavigation(drawer): ShapeNavigation

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:45

Description of the keys given to the drawer; the outline follows its shape (changes of other users) and is removed once the drawer can be modified again

Parameters
drawer ​

Drawer

Drawer whose shapes are reached

Returns

ShapeNavigation

Properties ​

$description ​

$description: HTMLSpanElement

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:34

Keys of the navigation, read by screen readers with the name of the drawer (aria-describedby)

drawer ​

drawer: Drawer

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:32

Drawer whose shapes are reached

Accessors ​

_selectWidget ​
Get Signature

get private _selectWidget(): SelectWidget | undefined

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:78

Selection tool reaching the shapes, unless the drawer can't be modified (read only) or has no selection tool

Returns

SelectWidget | undefined

selection widget, undefined when shapes are outlined instead

current ​
Get Signature

get current(): DrawingShape | null

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:62

Shape reached: the selected one (not the text of a selected shape), the outlined one without selection

Returns

DrawingShape | null

shape reached, null without one

Methods ​

_enter() ​

private _enter(): boolean

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:283

Enter: first shape of the drawing, of the group or frame reached, else text of the shape reached edited (as a double click)

Returns

boolean

true when a shape was reached or a text edited

_givenName() ​

private _givenName(shape): string

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:231

Name given by the user to a shape

Parameters
shape ​

DrawingShape

Shape of the drawing

Returns

string

its name (title of a frame), empty without

_inside() ​

private _inside(shape): Container<Node<NodeConfig>, ContainerConfig> | null

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:312

Shapes inside a shape

Parameters
shape ​

DrawingShape

Shape of the drawing

Returns

Container<Node<NodeConfig>, ContainerConfig> | null

content of a frame, the group itself, null for other shapes

_name() ​

private _name(shape): string

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:222

Short name of a shape in the description of another one (ends of an arrow, frame or group holding it)

Parameters
shape ​

DrawingShape

Shape of the drawing

Returns

string

name given by the user, else first line of its text, else its type

_outline() ​

private _outline(shape): void

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:322

Outline the shape reached without selection, remove the outline

Parameters
shape ​

DrawingShape | null

Shape reached, null to remove the outline

Returns

void

_placeOutline() ​

private _placeOutline(): void

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:336

Place the outline around the shape reached without selection (created again once the selection layer is emptied), removed with its shape

Returns

void

_text() ​

private _text(shape): string | undefined

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:242

Text of a shape: a text, or the text of a rectangle, ellipse, path shape or arrow

Parameters
shape ​

DrawingShape

Shape of the drawing

Returns

string | undefined

its text, undefined without

_type() ​

private _type(shape): string

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:253

Type of a shape

Parameters
shape ​

DrawingShape

Shape of the drawing

Returns

string

translated type (rectangle, note, frame, type of a plugin...), class name of other shapes

clear() ​

clear(): void

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:170

Leave the shapes: selection cleared, outline removed

Returns

void

describe() ​

describe(shape): string

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:181

Description of a shape read by screen readers: name given by the user (title of a frame), type, text, number of shapes inside, shapes linked by an arrow, link, locked, frame or group holding it, number among its shapes

Parameters
shape ​

DrawingShape

Shape of the drawing, of a frame or of a group

Returns

string

description in the language of the drawer

enter() ​

enter(): DrawingShape | null

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:122

Reach the first shape of the current group or frame, the first shape of the drawing without current shape

Returns

DrawingShape | null

shape reached, null without shape inside (or a locked group: selected as a whole)

exit() ​

exit(): DrawingShape | null

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:137

Reach the group or frame of the current shape

Returns

DrawingShape | null

group or frame reached, null for a shape of the drawing

getShapes() ​

getShapes(parent?): DrawingShape[]

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:90

Shapes reached from one another: visible drawing shapes of a parent, but texts of shapes (described with them), in reading order

Parameters
parent? ​

Container = ...

Draw layer, content of a frame or group

Returns

DrawingShape[]

shapes of the parent

handleKey() ​

handleKey(e): boolean

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:263

Keys of the navigation, with the focus on the drawer itself (its buttons and fields keep their keys). Called by HotKey

Parameters
e ​

KeyboardEvent

Keydown of the drawer

Returns

boolean

true when the key was used (its default prevented by HotKey)

next() ​

next(step?): DrawingShape | null

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:106

Reach the next (or previous) shape among the shapes of the current one, the first (last) one of the drawing without current shape

Parameters
step? ​

number = 1

1 for the next shape, -1 for the previous one

Returns

DrawingShape | null

shape reached, null without shape

reach() ​

reach(shape): DrawingShape

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:151

Shape reached: selected (with the selection tool), else outlined; shown in the view, described to screen readers

Parameters
shape ​

DrawingShape

Shape of the drawing, of a frame or of a group

Returns

DrawingShape

the shape

Variables ​

const navigationOutlineName: "drawer-navigation-outline" = 'drawer-navigation-outline'

Defined in: packages/free-drawing/src/utils/shapeNavigation.ts:17

Name of the outline of the shape reached without selection (read only), in the selection layer