class Tessell::Kit::Root

Defined in:

tessell/kit/root.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(content : Component, theme : Theme = Theme.light, metrics : TextMetrics = StubTextMetrics.new, viewport : Rect = Rect.new(0.0_f32, 0.0_f32, 800.0_f32, 600.0_f32), scale : Float32 = 1.0_f32) #

[View source]

Instance Method Detail

def a11y : A11y::Builder #

[View source]
def a11y_emit(sink : Array(A11y::Node)) : Int32 #

[View source]
def advance_time(now_ms : Int64) : Nil #

[View source]
def animate_composite(key : UI::UiKey, start_ms : Int64, opacity_from : Float32 = 1.0_f32, opacity_to : Float32 = 1.0_f32, tx_from : Float32 = 0.0_f32, tx_to : Float32 = 0.0_f32, ty_from : Float32 = 0.0_f32, ty_to : Float32 = 0.0_f32, scale_from : Float32 = 1.0_f32, scale_to : Float32 = 1.0_f32, duration_ms : Int64 = 300_i64, delay_ms : Int64 = 0_i64, easing : Proc(Float32, Float32) = ->Anim::Easing.linear(Float32), owner : Component | Nil = nil) : Anim::Track #

[View source]
def animations_active? : Bool #

[View source]
def apply_hook : Proc(Nil) | Nil #

宿主回调缝:UI.apply 中途调用(重入模拟/未来列表 bind 的挂点)。 回调里触发 root.build 会被延迟为二段提交。


[View source]
def apply_hook=(apply_hook : Proc(Nil) | Nil) #

宿主回调缝:UI.apply 中途调用(重入模拟/未来列表 bind 的挂点)。 回调里触发 root.build 会被延迟为二段提交。


[View source]
def build : Nil #

[View source]
def build_warnings : Array(String) #

[View source]
def cancel_anim_owner(owner : Component) : Int32 #

owner(组件)dispose 收口:取消其名下全部轨。


[View source]
def cancel_composite(key : UI::UiKey) : Bool #

[View source]
def close_all_overlays : Nil #

[View source]
def close_overlay(entry : OverlayEntry) : Bool #

[View source]
def component_for_node(target : Node) : Component | Nil #

[View source]
def content : Component #

[View source]
def context : Context #

[View source]
def debug_info : DebugInfo | Nil #

[View source]
def debug_info=(info : DebugInfo | Nil) : Nil #

帧调试 overlay(issue #11):宿主每帧塞入 DebugInfo,F1 开关显示。


[View source]
def debug_overlay : DebugOverlay #

[View source]
def decl_count : Int32 #

观测面(issue #36 计数口径):当前声明批大小——合成动画稳态下 逐帧不变(不重建声明),供 spec 计数断言使用。


[View source]
def each_component(& : Component -> Nil) : Nil #

遍历当前全部挂载组件(含 overlay,issue #59 TestDriver selector 用)。


[View source]
def focus(component : Component) : Bool #

程序化聚焦:组件必须已经 build 过(Root#build 建立了 Node 映射)。


[View source]
def focused_component : Component | Nil #

[View source]
def handle(event : Tessell::Input::Event, modifiers : Modifiers | Nil = nil) : Bool #

核心事件入口。优先使用 Event 自带的 modifiers;显式参数用于旧调用点。


[View source]
def hover_component : Component | Nil #

[View source]
def layout(width : Float32, height : Float32) : Nil #

[View source]
def layout(viewport : Rect) : Nil #

[View source]
def metrics : TextMetrics #

[View source]
def node : Node #

[View source]
def open_dialog(dialog : Dialog) : OverlayEntry #

[View source]
def overlay_host : OverlayHost #

[View source]
def paint(painter : Painter) : Nil #

[View source]
def pool : UI::Pool #

[View source]
def router : Tessell::Input::Router #

[View source]
def scale=(value : Float32) : Nil #

DPI/缩放变更(issue #30):Context#scale= 联动清文本测量缓存后对 当前 viewport 重排。组件树、焦点、编辑状态全部保留——宿主跨屏 拖动/缩放时调用本方法,而不是重建 Root(重建会丢焦点与编辑态)。


[View source]
def theme : Theme #

[View source]
def theme=(theme : Theme) : Nil #

[View source]
def tick_animations(clock : Anim::Clock) : Bool #

推进一帧:闭式采样 + 写入 Node 合成态(变更标 CompositeOnly)。 返回是否仍有活动动画(宿主据此决定下一帧是否请求)。


[View source]