collapseTree method

void collapseTree([
  1. num? level
])

Hide each child node and the connecting link, and recursively collapse each child node. This changes the value of Part#isVisible of the whole subtree and the parts owned by those nodes and links. However, this root node's visibility is unchanged.

Links are assumed to go from the parent node to the children nodes, unless Diagram#isTreePathToChildren is false. Links for which Link#isTreeLink is false are ignored.

This sets #isTreeExpanded to false on this node and on all of the children nodes. For those child nodes that were expanded when they were collapsed, #wasTreeExpanded is set to true.

You can also pass in a number of levels to hide nodes beyond a certain level starting at this node. If you want to make sure that all nodes are expanded up to a particular level, call #expandTree. If you want to do both, call expandTree before calling collapseTree to collapse nodes expanded due to the #wasTreeExpanded flag.

This method does not perform a transaction or start any animation. You may want to call the CommandHandler#collapseTree command, which does perform a transaction and raise a DiagramEvent.

To collapse a Group's subgraph of Nodes and Links, use Group#collapseSubGraph. @param {number=} level How many levels of the tree, starting at this node, to keep expanded if already expanded; the default is 1, hiding all tree children of this node. Values less than 1 are treated as 1. @see #expandTree @see #findTreeParts

Implementation

void collapseTree([_i2.num? level]) {
  _i4.callMethod(
    this,
    'collapseTree',
    [level ?? _i5.undefined],
  );
}