feat: add padding, align, stack, and decoration layout containers#6
Merged
Conversation
AsPulse
added a commit
that referenced
this pull request
May 24, 2026
Switch the component pipeline to a Flutter / SwiftUI-style constraint-based layout protocol, and add the painting primitives needed for effects to work inside layout containers. PR #6's `BouncingDot` still took `scene_width`; that's gone. - Trait surface: `view_box()` → `layout(Constraints) -> Vec2` + `paint_bounds(size) -> Rect` + `render(size [, target])`. `Constraints { min, max }` with `tight` / `loose` / `tighten_cross` lives in `tellur-core::geometry` alongside `Axis`. - Layout containers: `SizeMode { Fill, Hug, Fixed(f32) }`; `Sized` / `Place` / `Frame` replace `Align`; `CrossAlign::Stretch` propagates a tight cross-axis constraint so children fill the stack. - `paint_bounds` propagation: raster containers union the child's paint rect into their own. `DecoratedBox` keeps the default and acts as a natural clip boundary. `composite_children` takes `paint_rect: Rect`. - `#[available]` attribute on a fn argument lets a component opt in to the parent-assigned size at render time. - `tellur-renderer::shadow` (new): `DropShadow` with a 3-pass box blur; `paint_bounds` and padding both expand by `3 * radius`. - Examples migrated. `BouncingDot` drops `scene_width` and wraps the circle in a `DropShadow`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add CSS-Box / Flexbox-style layout containers so scene composition can describe padding, stacking, alignment, and background fills declaratively instead of hand-computing anchor offsets at every call site. The containers preserve the existing "intrinsic-only"
view_box()model and ship symmetrically for vector and raster.tellur-core::geometry:EdgeInsetswithZERO/all/symmetric/onlyconstructors andhorizontal/vertical/top_leftaccessors.tellur-core::layout(new):Padding,Align,Stack,DecoratedBox,SizedBoxoverBox<dyn VectorComponent>.Stacktakes anaxis, an optional outersize,spacing, plusMainAlign(Start/Center/End/SpaceBetween/SpaceAround/SpaceEvenly) andCrossAlign(Start/Center/End).Alignsnaps a child's anchor onto the same anchor of a fixed-size parent box.DecoratedBoxpaints an optional background fill and/or border underneath the child, sized to the child's view_box.tellur-core::layout::raster: same five containers overBox<dyn RasterComponent>. RasterDecoratedBoxsupports a solid-color background only for now; a smallSolidRectrasterizes the fill by buffer-filling. Vector and rasterStackshare acompute_stack_layouthelper.VectorLayoutExt/RasterLayoutExt: fluent.padding(...),.background(...),.border(...),.align(...).tellur-core::layer:Layer::render's compositing loop extracted into apub(crate) composite_children(container_size, target, &[(pos, &dyn RasterComponent)])helper, shared with the raster layout containers.timeline_to_mp4swaps the four hand-computedAnchor::new(0.5, y_frac).point(scene_size)calls for aStack { axis: Vertical, size: Some(scene_size), main_align: SpaceEvenly, cross_align: Center, ... }.padding(EdgeInsets::all(100.0)).background(...).BouncingDotstill takesscene_width— making it intrinsic-free needs arender_within/Stretchfollow-up in a separate PR.