1 unstable release
0.0.1 | Aug 14, 2022 |
---|
#4 in #yoga
18KB
478 lines
soga
Yoga alternative
Test
cargo test
Use
use soga::flexbox::FlexBox;
use soga::flexbox::FlexItem;
use std::convert::TryInto;
fn main() {
let mut root = FlexItem::new(100, 100);
let child1 = FlexItem::new(100, 50);
let child2 = FlexItem::new(100, 50);
root.add(child1);
root.add(child2);
let mut flexbox = FlexBox::new();
flexbox.layout(&mut root);
assert_eq!(root.children[0].frame, [0, 0, 100, 50]);
assert_eq!(root.children[1].frame, [50, 0, 100, 50]);
}
License
MIT ©yisar inspired by yoga.
Dependencies
~240–690KB
~16K SLoC