enum CaretBlink
Swift
enum CaretBlink
Caret blink, expressed as a phase rather than a timer.
The plan called for deciding this deliberately rather than drifting into it: a blinking caret dirties a frame twice a second forever, which is the one thing that defeats idle frame-gating. The compromise here is to blink only while focused, and to hold the caret solid for a moment after any edit so it never blinks mid-typing.
The phase is a pure function of the clock, so it is shared; what is per
window (WindowScope.caretLastPhase) is the last phase this window
drew, since two windows both showing a caret would otherwise consume each
other's flips and one of them would stop blinking.
Sources/LavaUI/Focus.swift:122
Properties
static var isVisible: Bool { get }
Not documented.
Sources/LavaUI/Focus.swift:131
static let period: Double
Not documented.
Sources/LavaUI/Focus.swift:123
Methods
static func noteEdit()
Not documented.
Sources/LavaUI/Focus.swift:126
static func phaseChanged() -> Bool
Call once per frame while a field is focused: reports whether the blink phase flipped, which is the only reason an idle app needs to redraw.
Sources/LavaUI/Focus.swift:140
static func resync()
Adopts the current phase without reporting a change. The blink is
suspended while the window is invisible, so lastPhase is stale by an
arbitrary number of periods on restore; the caller redraws once anyway
and only wants the next phaseChanged() to be meaningful.
Sources/LavaUI/Focus.swift:151