I have an application where I am dragging and dropping nodes onto the canvas. If I drop a node over a group I need to know that the drop point is within the bounds of the group. The problem arises when I drop a node onto a link. I know I can find out what object/part the node was dropped onto. In the case of dropping directly onto a group or onto a node I can figure out if I am dropping over a group. In the case of dropping onto a node I can find out if the node is part of a group and if it is which group it is contained in. When I drop onto a link however I can not find out if I am dropping onto a group because the link does not have information indicating if it is in a group. I understand there is no information for whether a link is in a group or not because it does not have to be completely contained in a group. Is there a way I can find out when I am dropping a node onto a link whether or not my drop point is within the bounds of a group.
Thank you in advance for your assistance.
First I should point out that actually you can get the Link.containingGroup. However, because links may cross group boundaries, i.e. connect between a node that is not a member of a group and a node that is a member of the group, for your purposes it might be confusing or misleading.
I think you might want to just see if there are any Groups in the collection returned by a call to Diagram.findPartsAt, where you pass that Point as the first argument. There might be more than one Group at that point, either because of nested groups or because of overlapping separate groups. You’ll need to decide which group you really want.
Diagram | GoJS API