Adding child to canvas container in runtime does not repect offset values

Hello.
I've found a problem while trying to add child to node with container set to Canvas. It does not respect set offset values. When I overwrite them after adding child, node is not moving from previous position (0, 0). As I saw, problem does not appear with predefined nodes (these used by [nodes] directive).

I've created stackblitz example that shows problem.
Thank you for your support.

1 Reply

AR Aravind Ravi Syncfusion Team May 15, 2020 09:53 AM UTC

Hi Jan, 
 
On analyzing the sample you have added new node to the group node container as diagram element. By default, in the diagram nodes only respect the offset values, for diagram element we does not give offset support. By using margin property we can add margin for the node. So for adding new node to the group node container set margin to the node. If you set margin top, left as 100, 100 new node renders with margin top , left as 100, 100. Please find the below code snippet for how to set margin for diagram element. 
 
const a = {id: uuidv4(), offsetX: 350, offsetY:350, height: 50, width: 50, container: { type: "Canvas", orientation: "Horizontal" }, 
    margin: {left: 50, top: 50, right: 0, bottom: 0 }} as unknown as DiagramElement; 
 
Please refer below screen shot 
 
 
 
Regards 
Aravind Ravi 


Loader.
Up arrow icon