Skip to main content

Module box_builder

Module box_builder 

Source
Expand description

Bridge from the Component tree to the new BoxNode tree.

Each ChildComponent becomes one BoxNode. The component’s style: CssStyle is augmented with:

  • position: absolute + top / left when child.position is set
  • width / height from the component’s size field (if any)
  • z-index from the child’s z_index field

Container components (Card / Flex / Grid / Container / Positioned) recursively build child boxes. Leaf components produce an empty-children box that the dispatcher will paint.

The builder also returns a flat Vec<&Component> indexed by NodeId so the painter can resolve a node back to its component.

Structs§

BuildAnimationCtx
Frame-level context passed into the builder so animations can be resolved per-node and merged into the resulting CssStyle. When None, the box tree is built without any animation overrides (resting state).
BuiltScene
Result of building a box tree from a scene description.

Functions§

build_scene
Build a box tree for a flat list of scene-level children at a given viewport size.
build_scene_at_time
Like build_scene_with_root but resolves animations at time (seconds) for each node and merges the result into its CssStyle. Use this when rendering an animated frame.
build_scene_from_refs
Same as build_scene_with_root but accepts an iterator over &ChildComponent references. Useful when the caller has filtered or re-ordered the scene’s children and doesn’t want to clone.
build_scene_with_anim
Like build_scene but with an animation context. Convenience wrapper that uses the default root CSS (full-viewport flex column).
build_scene_with_root
Same as build_scene but lets the caller supply the root container’s CssStyle. Width/height are forced to the viewport regardless.
component_kind
Short kind label for a component (for studio selection / inspector display).
effective_effects
The full effect list for a component at paint time: style.animation, plus timeline steps shifted by their at, plus keyframes synthesized from timeline style-state changes (style.transition), plus the container-stagger delay applied to everything. Returns None when there is nothing to resolve, Some(Cow::Borrowed) on the no-merge fast path.