https://github.com/jezza/gridlay
Grid Layout Engine
https://github.com/jezza/gridlay
grid layout-engine rust
Last synced: 2 months ago
JSON representation
Grid Layout Engine
- Host: GitHub
- URL: https://github.com/jezza/gridlay
- Owner: Jezza
- License: mit
- Created: 2020-03-02T19:32:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-15T22:36:36.000Z (about 5 years ago)
- Last Synced: 2025-02-12T14:31:13.980Z (4 months ago)
- Topics: grid, layout-engine, rust
- Language: Rust
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GridLay
A simple Rust grid layout engine.
```rust
use gridlay::{GridLay, lines, Props};pub fn main() {
let mut grid = GridLay::new();let a = grid.new_leaf(Props::sized(1.0, 1.0));
let b = grid.new_leaf(Props::sized(2.0, 2.0));
let c = grid.new_leaf(Props::sized(1.0, 3.0));let parent = grid.new_node(lines! {
a b;
c c;
}).unwrap();let d = grid.new_leaf(Props::sized(1.0, 3.0));
let root = grid.new_node(lines! {
d parent;
}).unwrap();let layout = grid.compute_layout(root).unwrap();
// `layout` contains each node's layout data (size and location),
// as well, as the total size of the layout.
}
```I designed it to be simple, because I only need a simple layout engine.
I'm using this to dogfeed my `kog` project.If you have any issues, questions, or suggestions, feel free to open an issue.