Changing the layout using templatemap taking away default animation

By default when I collapse/expand the group, it does some sort of animation during collapsing or expanding. also, it pushes all nearby nodes away by some animations.

Now when I am using a different template (which looks more like a Node), I have to change the category of it so that it shows different representations. In this case, it doesn’t perform an animation. As soon as category changed and I call expandGroup function it happens immediately without looking like an animation.

any method I can use to give it the same behaviour as earlier?

How are you changing the category? What does your expandGroup function do?

expandGroup(e: any, node: go.Group) {
    if (node.data.category == 'TrustBoundary')
      this.myDiagramComponent.diagram.model.setCategoryForNodeData(node.data, "TrustBoundaryExpanded");
    else if (node.data.category == 'Collection')
      this.myDiagramComponent.diagram.model.setCategoryForNodeData(node.data, "CollectionExpanded");
    node.expandSubGraph();
  }

In general methods on the various GraphObject classes, including Part, Node, and Group, do not perform transactions or animations.

So instead of calling Group.expandSubGraph, try calling CommandHandler.expandSubGraph.

1 Like