sleen / flexlayout Goto Github PK
View Code? Open in Web Editor NEWan implementation of Flexbox(Flexible Box) layout algorithm
License: MIT License
an implementation of Flexbox(Flexible Box) layout algorithm
License: MIT License
I want to relayout my ui, but the result is not change. Like this, first I set child1 height is 50, But when the context is too much, I will set child1 is 150. So I set Height is 150, I hope reLayout the root. But is not change. code like as follows:
FlexNodeRef root = Flex_newNode();
Flex_setDirection(root, FlexVertical);
FlexNodeRef child1 = Flex_newNode();
Flex_setWidth(child1, 50);
Flex_setHeight(child1, 50);
Flex_addChild(root, child1);
FlexNodeRef child2 = Flex_newNode();
Flex_setWidth(child2, 50);
Flex_setHeight(child2, 50);
Flex_addChild(root, child2);
Flex_layout(root, FlexUndefined, FlexUndefined, 1);
// re-layout child1
Flex_setHeight(child1, 150);
Flex_layout(root, FlexUndefined, FlexUndefined, 1);
Flex_print(root, FlexPrintDefault);
the running result in vscode like this:
First printLayout:
{
direction: vertical
result-width: 50.0
result-height: 100.0
children: [
{
width: 50.0
height: 50.0
result-width: 50.0
result-height: 50.0
}
{
width: 50.0
height: 50.0
result-y: 50.0
result-width: 50.0
result-height: 50.0
}
]
}
Second printLayout:
{
direction: vertical
result-width: 50.0
result-height: 100.0
children: [
{
width: 50.0
height: 150.0
result-width: 50.0
result-height: 50.0
}
{
width: 50.0
height: 50.0
result-y: 50.0
result-width: 50.0
result-height: 50.0
}
]
}
Second layout child2 result-y is still 50, it should be 150. cause i change child1 height 150. I don't know how to do this, maybe is not use this method to relayout. Can u help me?
能支持browser就好了,试了一下yoga,太大了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.