LavaUI docs GitHub

struct SurfaceAnchor

Swift

struct SurfaceAnchor

A rectangle in the parent surface's own coordinates. A popup hangs just below it; the compositor turns that into a position on screen, because the client does not know where its window is.

Sources/LavaUI/LavaApp.swift:266

Constructors

init(x: Float, y: Float, w: Float, h: Float, in window: WindowID? = nil)

Creates an anchor from a rectangle.

Sources/LavaUI/LavaApp.swift:282

init(_ frame: LayoutFrame, in window: WindowID? = nil)

Creates an anchor from a view's laid-out frame.

Sources/LavaUI/LavaApp.swift:291

Properties

var h: Float

Height, in pixels.

Sources/LavaUI/LavaApp.swift:274

var w: Float

Width, in pixels.

Sources/LavaUI/LavaApp.swift:272

var window: WindowID?

The window the rectangle is in, and the popup hangs off; nil for the window the app started with. A popup of a popup — a pane beside it — names the first one here, and the compositor keeps the first open while the pane is pressed.

Sources/LavaUI/LavaApp.swift:279

var x: Float

Left edge, in the parent surface's pixels.

Sources/LavaUI/LavaApp.swift:268

var y: Float

Top edge, in the parent surface's pixels.

Sources/LavaUI/LavaApp.swift:270

Methods

static func leftOf(_ window: WindowID, width: Float, top: Float = 0, gap: Float = 8) -> SurfaceAnchor

A popup width wide placed against the left edge of window — a pane beside a popup that is near the right of the screen — its top top below the window's.

Built on the compositor's placement rule (Server::placePopup): a popup goes just below its anchor, kGap (6) down, at the anchor's left edge unless that runs off the right of the work area. A zero-height anchor kGap above where the pane should start, and a pane's width plus a gap to the left of the window, is a pane beside it.

Sources/LavaUI/LavaApp.swift:305