Question on MosaicNode format
Artur93gev opened this issue · comments
Hi. Thanks for this great package.
Sorry for not being according to the template provided(I have a question).
Is there a way to convert the MosaicNode to corresponding (x, y, width, height)
and also the reverse convert?
Example.
{
direction: 'row',
first: 'a',
second: 'b',
splitPercentage: 40,
}
I want it to become.
[{
x: 0,
y: 0,
width: 100,
height: 40,
},
{
x: 0,
y: 40,
width: 100,
height: 60,
}
]
NOTE:: all the values are in percents
That's essentially what mosaic does for you natively: https://github.com/nomcopter/react-mosaic/blob/master/src/MosaicRoot.tsx#L31
So, definitely possible, but ideally something you shouldn't need.