I’ve just noticed in our app that if I select two objects in separate groups and drag them so they remain in their respective groups, after the move one of them moves into the the other group. I think this is an issue with GoJS since the BPMN editor sample also suffers from the same problem. Select two activities in different lanes, drag them right and one of them switches lanes. Is this a bug or intentional? If intentional, is there a way to turn it off?
This sounds like one of the rules added so that dropping a selection on a group adds all the members of that selection to the group.
In BPMN that’s:
var subProcessGroupTemplate =
...
mouseDrop: function(e, grp) {
var ok = grp.addMembers(grp.diagram.selection, true);
if (!ok) grp.diagram.currentTool.doCancel();
},
How you want to change the code is up to you. You could modify the code so that when dropping a selection onto a group, it does not change any group ownership if the selection represents nodes in multiple groups, and otherwise call addMembers, or some similar rule. (Perhaps you only want mousDrop to function when the grp.diagram.selection.count === 1, etc)
You’re right, removing the mouseDrop code fixes it for that particular scenario. Now just have to figure out how to deal with it when the group should change. Sorry for jumping to the conclusion it was a GoJS bug!
Well, its a GoJS effect, it was just a question of culprit, and the functionality provided in BPMN is not adequate enough for production-app use, only demonstration.
I would suggest modifying the mousedrop instead of nixing it altogether, just consider carefully what functionality you really want.