Group Node mousedrop event - and drop on node

I am dropping node from pallete to diagram in Group node. The mouseDrop event is assigned for groupTemplate.
Group node already have some nodes inside. Now whenever new node is dropped from pallete, mouseDrop event gets fired. Same event gets fired even when node is dropped on the any of node.
How one can get the node on which new node is dropped ? (Using mouseDrop event attached to group template)
The sample code is similar to thread - Repositioning node link gets truncated

To detect the node on which, drop happened - attaching same function mouseDrop event in node template causes same function fired twice - one for node and another for group. - so expecting to attach the event for group template only and detect drop happening on node or group.

You have probably set Group.handlesDragDropForMembers, Group | GoJS API , to true, so that the Group automatically gets the drag and drop events for its member Nodes and Links.

It’s probably easiest to look at the InputEvent.targetObject. That GraphObject might belong to a Node or to a Link or to the Group, depending on where the drop occurred.

yes. Group template has Group.handlesDragDropForMembers set to true.

But at my end, for mouseDrop event for groupTemplate, the InputEvent.targetObject is neither group nor node. with following code no statement gets printed in console.
image

It’s probably easiest to look at the InputEvent.targetObject. That GraphObject might belong to a Node or to a Link or to the Group, depending on where the drop occurred.

That object might be in the visual tree of a Node or a Link…

There is no links. But what I observed is

  • when drop happen on text of node , e.targetObject matches with instance of go.TextBlock and e.targetObject.part instance matches with go.Node.

When drop is other part of node or somewhere in group then it matches with e.targetObject.part instanceof go.Node or go.Group.

Yes, depending on where the drop occurs, the InputEvent.targetObject might be any GraphObject within the Group or within any Node that is a member of the Group.