LavaUI docs GitHub

enum HoverState

Swift

enum HoverState

Which node the pointer is over.

Tracked as a single id rather than per-node flags so a move only ever invalidates when the hovered node changes — pointer motion arrives per pixel, and redrawing on every one of those would undo the frame gating.

One id for the whole process, not one per window, because the pointer is one thing: moving from window A into window B has to un-hover A's button, and nothing else reliably reports that. GLFW's cursor-leave would, but only for the window the pointer left — a pointer that jumps straight from one window to another still needs the arrival to do the work. So the scope that was current when the hover was set is remembered alongside it, and a cross-window move repaints both windows.

Sources/LavaUI/Focus.swift:614

Methods

static func clear()

Forgets the hovered node, calling its handler with false.

Sources/LavaUI/Focus.swift:664

static func isHovered(_ id: NodeID) -> Bool

Whether id is the node under the pointer.

Sources/LavaUI/Focus.swift:625

static func register(_ id: NodeID, handler: @escaping (Bool) -> Void)

Calls handler with true when the pointer enters id and false when it leaves.

Sources/LavaUI/Focus.swift:631

@discardableResult static func set(_ id: NodeID?) -> Bool

Returns true when the hovered node actually changed.

Sources/LavaUI/Focus.swift:651

static func unregister(_ id: NodeID)

Removes id's hover handler.

Sources/LavaUI/Focus.swift:636