Child node renders outside group node bounds

image

As in above image you can see, child node which is having increased width to contain all text is rendered outside the group. Same scenario happens if child node are resizable, in that case also child nodes renders outside group node bounds.

For reference you can check in bellow example by changing child node text. (in example child nodes are not resizable)

Dragging of Child node should not be possible outside the boundry of shape,
please help me with this issue, Thanks in advance.

The stayInGroup function in the Swim Lanes sample, https://gojs.net/latest/samples/swimLanes.html , is an example of a Part.dragComputation function that customizes the DraggingTool’s behavior to keep nodes within the rectangular bounds of the containing Group’s Placeholder. If the area in which you want to limit the nodes is circular, you will want to adapt that function to take the geometry of the shape into account.
https://gojs.net/latest/api/symbols/Part.html#dragComputation

I tried to use as mentioned “dragComputation: stayInViewport” instead of “dragComputation: stayInGroup”, but now it is allowing to drag node even outside the group node bounds.

I also added “myDiagram.autoScrollRegion = 0;”,

if you share any example, would be realy helpful, thanks in advance.

Yes, the stayInViewport function is given as an example of keeping the dragged node from leaving the current viewport, but why would you use that when you want the dragging to stay within the group of which the node is a member?

How to use shape geometry for this in stayInGroup method, can you please explain me with example.

You could implement a custom Part.dragComputation function that checks to see whether the proposed move of the Part is going is within the bounds of what you want to allow.

If it is allowed, return the pt (the second argument). If not, return the original part.location.