Conversation
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
There was a problem hiding this comment.
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::Overlayand integrated it across axis/orientation helpers (types.rs,node.rs,cache.rs). - Implemented
layout_overlayand 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.
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.
Adds a new
Overlaylayout 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.