Fixed position in group sanity check

Hi all. I need a little hand holding here. I want to have a function where the user creates an group and all of the constituent parts are locked in place relative to one-another. So when the group or any of its parts are dragged they all move as one. I think the way to do this is to override computeEffectiveCollection in a dragging tool but just wanted to check and make sure I wasn’t missing some property of the group function that would make this easier.

It might suffice to implement a “SelectionGrouped” DiagramEvent listener. Maybe something like:

$(go.Diagram, . . .,
  { . . .,
    "SelectionGrouped": function(e) {
      var g = e.subject;  // this is the new Group
      g.findSubGraphParts().each(function(m) { m.movable = false; });

That should work to make newly created groups movable by any of their members. However, that doesn’t help to make all of those member Parts not movable if you have loaded the diagram/model. So I’m thinking that maybe this is better:

myDiagram.groupTemplate =
  $(go.Group, . . . .,
      memberAdded: function(g, m) { m.movable = false; }
    . . .);

But I’m not sure what your requirements really are – I’m just guessing.

OK thanks I will give it a go and see if it works.

OK, we are pretty close. I have modified the sample to include:
memberAdded: function (g, m) { m.movable = false; m.selectable = false; m.rotatable = false;
m.textEditable = true; },
memberRemoved: function (g, m) { m.movable = true; m.selectable = true; m.rotatable = true; }

Sorry can’t get the code to format.

It all works well except textblocks in the group are not editable. I would like them to be editable.

Yes, by default the TextEditingTool expects the Part (holding the TextBlock) to be selected. Customize the tool to operate without having the Node be selected.

      $(go.Diagram, . . .,
        { . . .,
          "textEditingTool.starting": go.TextEditingTool.SingleClick

Or use go.TextEditingTool.DoubleClick if that is what you would prefer.

That does it!