Skip to content

Add Overlay layout type and implementation#37

Merged
geom3trik merged 2 commits into
mainfrom
overlay
Apr 24, 2026
Merged

Add Overlay layout type and implementation#37
geom3trik merged 2 commits into
mainfrom
overlay

Conversation

@geom3trik
Copy link
Copy Markdown
Collaborator

@geom3trik geom3trik commented Apr 24, 2026

Adds a new Overlay layout type to the layout engine, allowing child elements to be positioned independently and overlap within a parent node whilst still respecting parent padding and alignment. This allows the zstack in Vizia to no longer require children to be absolutely positioned.

Screenshot 2026-04-24 at 16 44 47

Introduce a new LayoutType::Overlay and implement overlay layout behavior. Added layout_overlay in src/layout.rs with alignment, absolute positioning, padding/border handling and stabilization logic; integrated overlay into layout selection and axis abstractions (node.rs, cache.rs, types.rs). Updated README to document the new Overlay variant and adjusted imports/utility functions. Added tests/tests overlay.rs to cover relative overlap, alignment, padding, autosizing and absolute child positioning.

fmt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Overlay layout mode to Morphorm’s layout engine so children can be aligned independently within a parent’s padded bounds (allowing overlap), including absolute-positioned children, with documentation and tests.

Changes:

  • Added LayoutType::Overlay and integrated it across axis/orientation helpers (types.rs, node.rs, cache.rs).
  • Implemented layout_overlay and refactored absolute positioning math into a shared helper (src/layout.rs).
  • Added overlay-specific test coverage and updated README documentation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/layout.rs Adds overlay layout algorithm, shared absolute-axis resolver, and dispatch integration.
src/types.rs Introduces LayoutType::Overlay and updates helper selection + Display formatting.
src/node.rs Updates axis/orientation helpers to treat Overlay as row-like for main/cross behavior.
src/cache.rs Extends direction-agnostic set_rect to support Overlay.
tests/overlay.rs Adds tests for overlap, alignment, padding offsets, autosizing, and absolute children in overlay.
README.md Documents the new overlay layout type and its behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/layout.rs Outdated
Comment thread src/layout.rs Outdated
@geom3trik geom3trik merged commit 37fa5ae into main Apr 24, 2026
4 checks passed
@geom3trik geom3trik deleted the overlay branch April 24, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants