child nodes get repositioned correctly when resizing top or left

This commit is contained in:
peterkogo
2024-01-23 12:35:24 +01:00
parent 8a9f8127b5
commit abc6fea20b
5 changed files with 111 additions and 7 deletions
@@ -116,6 +116,29 @@ const initialNodes: Node[] = [
position: { x: 250, y: 400 },
style: { ...nodeStyle },
},
{
id: '5',
type: 'defaultResizer',
data: { label: 'Parent' },
position: { x: 700, y: 0 },
style: { ...nodeStyle, width: 300, height: 300 },
},
{
id: '5a',
type: 'defaultResizer',
data: { label: 'Child' },
position: { x: 50, y: 50 },
parentNode: '5',
style: { ...nodeStyle },
},
{
id: '5b',
type: 'defaultResizer',
data: { label: 'Child' },
position: { x: 100, y: 100 },
parentNode: '5',
style: { ...nodeStyle },
},
];
const CustomNodeFlow = () => {
@@ -100,6 +100,29 @@
data: { label: 'horizontal resizer with maxWidth', maxWidth: 300 },
position: { x: 250, y: 400 },
style: nodeStyle
},
{
id: '5',
type: 'defaultResizer',
data: { label: 'Parent' },
position: { x: 700, y: 0 },
style: nodeStyle + 'width: 300px; height: 300px'
},
{
id: '5a',
type: 'defaultResizer',
data: { label: 'Child' },
position: { x: 50, y: 50 },
parentNode: '5',
style: nodeStyle
},
{
id: '5b',
type: 'defaultResizer',
data: { label: 'Child' },
position: { x: 100, y: 100 },
parentNode: '5',
style: nodeStyle
}
]);