Skip to content

Commit 0db331d

Browse files
fixed grandchildren HTML issues
1 parent 61c5f26 commit 0db331d

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

src/components/GrandchildRectangle.jsx

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class GrandchildRectangle extends Component {
2020
scaleY,
2121
childId,
2222
componentId,
23+
childType,
2324
childComponentName,
2425
childComponentId,
2526
width,
@@ -46,41 +47,46 @@ class GrandchildRectangle extends Component {
4647
y={0}
4748
childId={childId}
4849
componentId={componentId}
50+
childType={childType}
4951
scaleX={1}
5052
scaleY={1}
5153
width={width}
5254
height={height}
53-
stroke={this.getComponentColor(childComponentId)}
55+
stroke={childType === 'COMP' ? this.getComponentColor(childComponentId) : '#000000'}
5456
// fill={color}
5557
// opacity={0.8}
5658
strokeWidth={4}
5759
strokeScaleEnabled={false}
5860
draggable={false}
5961
/>
60-
{components
61-
.find(comp => comp.title === childComponentName)
62-
.childrenArray.filter(child => child.childId !== '-1')
63-
.map((grandchild, i) => (
64-
<GrandchildRectangle
65-
key={i}
66-
components={components}
67-
componentId={componentId}
68-
childComponentName={grandchild.componentName}
69-
childComponentId={grandchild.childComponentId}
70-
focusChild={focusChild}
71-
childId={childId}
72-
width={grandchild.position.width * (width / this.getPseudoChild().position.width)}
73-
height={grandchild.position.height * (height / this.getPseudoChild().position.height)}
74-
x={
75-
(grandchild.position.x - this.getPseudoChild().position.x)
76-
* (width / this.getPseudoChild().position.width)
77-
}
78-
y={
79-
(grandchild.position.y - this.getPseudoChild().position.y)
80-
* (height / this.getPseudoChild().position.height)
81-
}
82-
/>
83-
))}
62+
{childType === 'COMP'
63+
&& components
64+
.find(comp => comp.title === childComponentName)
65+
.childrenArray.filter(child => child.childId !== '-1')
66+
.map((grandchild, i) => (
67+
<GrandchildRectangle
68+
key={i}
69+
components={components}
70+
componentId={componentId}
71+
childType={grandchild.childType}
72+
childComponentName={grandchild.componentName}
73+
childComponentId={grandchild.childComponentId}
74+
focusChild={focusChild}
75+
childId={childId}
76+
width={grandchild.position.width * (width / this.getPseudoChild().position.width)}
77+
height={
78+
grandchild.position.height * (height / this.getPseudoChild().position.height)
79+
}
80+
x={
81+
(grandchild.position.x - this.getPseudoChild().position.x)
82+
* (width / this.getPseudoChild().position.width)
83+
}
84+
y={
85+
(grandchild.position.y - this.getPseudoChild().position.y)
86+
* (height / this.getPseudoChild().position.height)
87+
}
88+
/>
89+
))}
8490
</Group>
8591
);
8692
}

src/components/Rectangle.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Rectangle extends Component {
126126
components={components}
127127
componentId={componentId}
128128
directParentName={childComponentName}
129+
childType={grandchild.childType}
129130
childComponentName={grandchild.componentName}
130131
childComponentId={grandchild.childComponentId}
131132
focusChild={focusChild}

0 commit comments

Comments
 (0)