Calling layout on children before laying out node
This commit is contained in:
parent
e70705be5f
commit
1ee3055f37
@ -16,6 +16,10 @@ const layout = data => {
|
|||||||
|
|
||||||
const { type } = data;
|
const { type } = data;
|
||||||
|
|
||||||
|
if (data.children) {
|
||||||
|
data.children = data.children.map(layout);
|
||||||
|
}
|
||||||
|
|
||||||
return nodeTypes[type]({
|
return nodeTypes[type]({
|
||||||
props: {},
|
props: {},
|
||||||
...data
|
...data
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import layout from 'layout';
|
|
||||||
|
|
||||||
const layoutSVG = data => {
|
const layoutSVG = data => {
|
||||||
const child = layout(data.children[0]);
|
const child = data.children[0];
|
||||||
|
|
||||||
data.props.innerWidth = child.box.width;
|
data.props.innerWidth = child.box.width;
|
||||||
data.props.innerHeight = child.box.height;
|
data.props.innerHeight = child.box.height;
|
||||||
|
Loading…
Reference in New Issue
Block a user