LavaUI docs

struct CanvasGesture

Swift

struct CanvasGesture

One pointer event delivered to a Canvas's onGesture.

Sources/LavaUI/Canvas.swift:31

Properties

var button: Int32

Which button started this: 0 left, 1 right, 2 middle, matching GLFW and the order the compositor forwards them in.

A canvas that only wants the primary button has to check, because every button arrives here — which is the honest default for a surface whose whole point is that the app decides what a press means. Middle-click paste and a right-click menu are the two that need it.

Sources/LavaUI/Canvas.swift:64

var clickCount: Int

How many clicks this press continues: 1 for a single, 2 for a double, 3 for a triple. Carried through .moved and .ended like mods, so a double-click-and-drag knows all the way through that it is extending by words.

Here rather than left to the caller because the caller would have to find ClickCounter to get it, and one that reached for a timer of its own would disagree with the text editor and the title bar about what a double-click is — on the same desktop, under the same finger.

Sources/LavaUI/Canvas.swift:56

var frame: CanvasFrame

Current absolute canvas geometry, identical to the frame passed to paint. This makes local coordinates reversible without app-owned frame caches (for example, committing a drag range to chart values).

Sources/LavaUI/Canvas.swift:42

var localX: Float

Relative to the canvas's own top-left, matching CanvasFrame. Can go negative, or past w/h, once a drag leaves the box.

Sources/LavaUI/Canvas.swift:35

var localY: Float

Not documented.

Sources/LavaUI/Canvas.swift:36

var mods: Int32

Modifiers held at .began (see KeyMods). Not re-read for .moved/.ended — a drag can't ask again mid-flight, only a fresh press reflects current state, so this stays whatever .began saw.

Sources/LavaUI/Canvas.swift:46

var phase: CanvasGesturePhase

Not documented.

Sources/LavaUI/Canvas.swift:32

var windowX: Float

Not documented.

Sources/LavaUI/Canvas.swift:37

var windowY: Float

Not documented.

Sources/LavaUI/Canvas.swift:38