An open API service indexing awesome lists of open source software.

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

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.