Backend-agnostic retained UI-tree abstraction for Kagura (UINode, layout constraints, input/render adapters; extracted from kagura_engine)
Dependencies
mizchi/kagura_ui does not have a README file
pub trait LayoutEngine {
fn compute_layout(Self, root : UINodeId, constraint : LayoutConstraint) -> Array[LayoutResult] raise
}pub trait UIInputAdapter {
fn from_input_snapshot(Self, snapshot : InputSnapshot) -> Array[UIEvent]
}pub trait UIRenderAdapter {
fn build_draw_commands(Self, frame : FrameBudget, layouts : Array[LayoutResult], target : ImageHandle) -> Array[DrawTrianglesCommand] raise
}pub struct LayoutConstraint {
min_width : Double
min_height : Double
max_width : Double
max_height : Double
} derive(Debug)impl LayoutEngine for SimpleLayoutEnginefn compute_layout(self : SimpleLayoutEngine, root : UINodeId, constraint : LayoutConstraint) -> Array[LayoutResult] raisefn SimpleLayoutEngine::compute_layout(self : SimpleLayoutEngine, root : UINodeId, constraint : LayoutConstraint) -> Array[LayoutResult] raiseimpl UIInputAdapter for SimpleUIInputAdapterfn SimpleUIInputAdapter::from_input_snapshot(self : SimpleUIInputAdapter, snapshot : InputSnapshot) -> Array[UIEvent]impl UIRenderAdapter for SimpleUIRenderAdapterfn build_draw_commands(self : SimpleUIRenderAdapter, _frame : FrameBudget, layouts : Array[LayoutResult], target : ImageHandle) -> Array[DrawTrianglesCommand] raisefn SimpleUIRenderAdapter::build_draw_commands(self : SimpleUIRenderAdapter, _frame : FrameBudget, layouts : Array[LayoutResult], target : ImageHandle) -> Array[DrawTrianglesCommand] raisepub enum UIEvent {
PointerDown(Double, Double)
PointerUp(Double, Double)
PointerMove(Double, Double)
Scroll(Double, Double)
KeyDown(Int)
KeyUp(Int)
} derive(Debug)impl Show for UIFocusEventfn UIFocusManager::handle_pointer_down(self : UIFocusManager, layouts : Array[LayoutResult], x : Double, y : Double) -> Array[UIFocusEvent]pub(all) struct UINodeStyle {
direction : UIDirection
width : UISizing
height : UISizing
padding_left : Double
padding_right : Double
padding_top : Double
padding_bottom : Double
gap : Double
align : UIAlignment
justify_content : UIAlignment
flex_wrap : UIFlexWrap
} derive(Debug)impl Show for UINodeStylepub(all) struct UISafeArea {
top : Double
right : Double
bottom : Double
left : Double
} derive(Debug)impl Show for UISafeAreapub(all) struct UISnapshot {
screen_width : Double
screen_height : Double
dpr : Double
safe_area : UISafeArea
frame : Int
state : String
nodes : Array[UISnapshotNode]
focus_order : Array[String]
} derive(Debug)impl Show for UISnapshotpub(all) struct UISnapshotNode {
path : String
id : String
role : String
classes : String
left : Double
top : Double
width : Double
height : Double
z : Int
visible : Bool
clip : UISnapshotRect?
text : String?
text_measured : UITextMetrics?
focusable : Bool
focus_index : Int
focused : Bool
hit : UISnapshotRect?
} derive(Debug)impl Show for UISnapshotNodepub(all) struct UISnapshotRect {
left : Double
top : Double
width : Double
height : Double
} derive(Debug)impl Show for UISnapshotRectimpl Show for UITextMetricsfn ui_events_from_input_edge(key_state : KeyInputState, mouse_state : MouseButtonInputState, cursor_x : Double, cursor_y : Double) -> Array[UIEvent]Install
Download zipBackend-agnostic retained UI-tree abstraction for Kagura (UINode, layout constraints, input/render adapters; extracted from kagura_engine)
Dependencies