Skip to content

yisar/soga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soga

Yoga alternative

Build Status crates.io crates.io license

Test

cargo test

Use

use crate::soga::green::*;
use crate::soga::red::*;
use crate::soga::flex::*;

fn make_tree() -> RedTree {
    let tree: GreenTree = GreenTree::new("div", 10, 10) // 0 0 10 10
        .push(
            GreenTree::new("ul", 6, 6) // 0 0 6 6
                .push(GreenTree::new("li", 0, 6).set("grow", "1")) // 0 0 1 6
                .push(GreenTree::new("li", 0, 6).set("grow", "5")) // 1 0 5 6
        )
        .into();

    tree.into()
}

fn main() {
    let tree = make_tree();
    let mut flexbox = FlexBox::new();
    flexbox.layout(tree);
    assert_eq!(flexbox.records[0].rect, [0, 0, 10, 10]);
}

License

MIT ©yisar inspired by yoga.

About

Tiny layout engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages