flexbox-analyzer
v1.0.2
Published
Calculating the Flexbox properties of a container.
Downloads
5
Readme
flexlayout-calculate
Install
$ npm install flexlayout-calculate
Usage
const flexCalc = require('flexlayout-calculate');
const layers = `[
{
"id": "a71d9782-ab65-48b8-b0ec-2c2c6cb2f99e",
"frame": {
"x": 0,
"y": 0,
"width": 253,
"height": 160
},
"children": [
{
"id": "735c7862-d1d4-4f88-a104-e10d3192b4ad",
"frame": {
"width": 52,
"height": 150,
"x": 5,
"y": 5
}
},
{
"id": "848609e2-f3e0-46ac-8f8c-5ee930e27460",
"frame": {
"_class": "rect",
"constrainProportions": false,
"width": 53,
"height": 150,
"x": 67,
"y": 5
}
},
{
"id": "542cce99-ae24-4302-aeee-79e7689c58ed",
"frame": {
"_class": "rect",
"constrainProportions": false,
"width": 54,
"height": 150,
"x": 130,
"y": 5
}
}
]
}
]`;
flexCalc(layers)
/*
{
"wrap": "nowrap",
"padding": 5,
"gap": [
10,
10
],
"direction": "row",
"justifyContent": "center",
"alignItems": "center",
"alignContent": "center"
}
*/