gesture#

Classes#

GestureSlot#

Defined in: arranger/src/gesture.ts:80

The gesture in progress on one canvas, which Escape on the canvas ends. A pointer drives one gesture at a time; the canvas holds one slot in its context, so two canvases on a page never end each other’s gestures.

Constructors#

Constructor#

new GestureSlot(moving?): GestureSlot

Defined in: arranger/src/gesture.ts:85

moving hears whether a gesture that moves boxes is under way: on its start and on its end.

Parameters#
moving?#

(moving) => void

Returns#

GestureSlot

Methods#

abort()#

abort(): boolean

Defined in: arranger/src/gesture.ts:103

End the gesture in progress as Escape does; whether there was one.

Returns#

boolean

hold()#

hold(abort, moves?): void

Defined in: arranger/src/gesture.ts:90

A gesture has started, moving boxes or not; abort ends it without a command.

Parameters#
abort#

() => void

moves?#

boolean = false

Returns#

void

release()#

release(abort): void

Defined in: arranger/src/gesture.ts:96

The gesture holding abort has ended.

Parameters#
abort#

() => void

Returns#

void

Interfaces#

GestureOptions#

Defined in: arranger/src/gesture.ts:112

What the engine needs besides the strategy.

Properties#

clickDistance?#

readonly optional clickDistance?: number

Defined in: arranger/src/gesture.ts:114

Screen pixels a press may travel and still click; CLICK_DISTANCE by default.

dispatch#

readonly dispatch: (command) => void

Defined in: arranger/src/gesture.ts:116

Runs the command a release yields.

Parameters#
command#

Command

Returns#

void

slot?#

readonly optional slot?: GestureSlot

Defined in: arranger/src/gesture.ts:118

The canvas’s slot, which holds the gesture from its start to its end.


GesturePoint#

Defined in: arranger/src/gesture.ts:43

One pointer position in drawing and screen coordinates.

Properties#

drawing#

readonly drawing: Point

Defined in: arranger/src/gesture.ts:45

In the drawing’s units, through its <svg>’s screen CTM; the screen point outside a drawing.

screen#

readonly screen: Point

Defined in: arranger/src/gesture.ts:47

In client pixels.


GestureStrategy#

Defined in: arranger/src/gesture.ts:56

What a gesture does, from press to command. P is what a press holds, V the plain value the pointer stands for (a point, an order, a delta): the engine previews a value only when it differs, member by member, from the last one previewed.

Type Parameters#

P#

P

V#

V

Properties#

moves?#

readonly optional moves?: boolean

Defined in: arranger/src/gesture.ts:72

Whether the gesture moves boxes (an item, a held card, a band) rather than resizing one; the canvas’s slot reports it while the gesture is under way.

Methods#

command()#

command(press, value): Command | null

Defined in: arranger/src/gesture.ts:66

The command that stores value; null when it changes nothing.

Parameters#
press#

P

value#

V

Returns#

Command | null

preview()#

preview(press, value): void

Defined in: arranger/src/gesture.ts:64

Show value; null withdraws the preview, at the end of every started gesture.

Parameters#
press#

P

value#

V | null

Returns#

void

start()?#

optional start(press): void

Defined in: arranger/src/gesture.ts:60

The press has become a gesture: past the click distance, once.

Parameters#
press#

P

Returns#

void

takes()#

takes(event, at): P | null

Defined in: arranger/src/gesture.ts:58

What the press event at at holds; null leaves the press to the canvas.

Parameters#
event#

PointerEvent

at#

GesturePoint

Returns#

P | null

value()#

value(press, at): V | null

Defined in: arranger/src/gesture.ts:62

The value for the pointer at at; null when it stands for none.

Parameters#
press#

P

at#

GesturePoint

Returns#

V | null


Point#

Defined in: arranger/src/gesture.ts:37

A position: in a drawing’s own units, or in client pixels.

Properties#

x#

readonly x: number

Defined in: arranger/src/gesture.ts:38

y#

readonly y: number

Defined in: arranger/src/gesture.ts:39

Variables#

CLICK_DISTANCE#

const CLICK_DISTANCE: 4 = 4

Defined in: arranger/src/gesture.ts:34

How far, in screen pixels, a pointer may move between press and release and still click (touch and trackpads wobble). Svelte Flow’s pane uses the same distance for a click and a marquee.

Functions#

drawingPoint()#

drawingPoint(target, client): Point | null

Defined in: arranger/src/gesture.ts:144

The point of the drawing under the client point client, read through the screen CTM of the <svg> that target is drawn in (or is), never the target’s own, which a sliding reorder moves; null off every drawing or where it is drawn at no size. The one conversion that hover, a click and a press read.

Parameters#

target#

EventTarget | null

client#

Point

Returns#

Point | null


drawn()#

drawn(source): Attachment<Element>

Defined in: arranger/src/gesture.ts:163

Record that the element it is attached to draws source, so a pointer target is read back as what it draws (sourceAt), never from the DOM’s attributes.

Parameters#

source#

CanvasSource

Returns#

Attachment<Element>


listen()#

listen<E>(target, type, handler, options?): () => void

Defined in: arranger/src/gesture.ts:126

Listen to type on target at once; the function returned stops listening. Unlike svelte/events’ on, which adds pointer listeners a microtask later, a stop called right away leaves no listener behind.

Type Parameters#

E#

E extends Event

Parameters#

target#

EventTarget

type#

string

handler#

(event) => void

options?#

AddEventListenerOptions = {}

Returns#

() => void


pointerGesture()#

pointerGesture<P, V>(strategy, options): Attachment<Element>

Defined in: arranger/src/gesture.ts:219

The attachment that drives strategy on an element: an element of a block’s drawing (whose points are read in the drawing’s units) or a control outside one (a resize handle, whose drawing point is its screen point).

Type Parameters#

P#

P

V#

V

Parameters#

strategy#

GestureStrategy<P, V>

options#

GestureOptions

Returns#

Attachment<Element>


sourceAt()#

sourceAt(target): CanvasSource | null

Defined in: arranger/src/gesture.ts:173

The source a pointer target draws (drawn); null for anything else.

Parameters#

target#

EventTarget | null

Returns#

CanvasSource | null