How can I not allow nodes and groups to drag


#1

Hey guys!
I think I want to prevent the node from dragging when the node is dragged into the group. When a group is dragged into another group, the group is not dragged. How do I achieve this?
Thanks


#2

Do you mean you don’t want to allow a drop in those cases, or are do you want to actually prevent a node from being dragged there?

Maybe the Swim Lanes sample has some of the behavior you’re looking for?


#3

I want to achieve the node can not drag the group, you can give the example can also drag the group inside the node


#4

Sorry, it’s still not clear to me what you want. Could you describe the behavior you want in the context of the Regrouping sample?

What should happen if the user tries to drag “first A” into another group?
What should happen if the user tries to drag “first A” onto the diagram background?
What about dragging “Group B” into “Group A” or “Main 2”?


#5

Cannot drag the Group A and Group B groups in the Main1 group
Can’t drag first A and first B in Group A
Cannot drag Main1 group and Main2 group
Only drag nodes or groups from palette into Diagram


#6

You could set DraggingTool.isEnabled to false on your main diagram.

myDiagram =
  $(go.Diagram, "myDiagramDiv",
    {
      ...
      allowDrop: true, // from Palette
      "draggingTool.isEnabled": false,
      ...
    });