addTopLevelParts method

bool addTopLevelParts(
  1. Iterable<Part> coll, [
  2. bool? check
])

Make sure all of the unnested Parts in the given collection are removed from any containing Groups.

This sets Part#containingGroup to null on each Part that is not a member of another Part in the argument collection. If the check argument to this method is supplied and true, this will call #isValidMember on each part, passing null as the first argument.

This functionality is similar to #ungroupSelection, except that this is not a command (there is no transaction and this does not raise a DiagramEvent) and the parts are necessarily becoming top-level parts (whereas ungrouping would add them to the Group containing the Group being ungrouped).

This function is typically called in a Diagram#mouseDrop event handler in order to remove the selected Parts from whatever Group they had been in.

If you want to add Parts to be members of a Group, call Group#addMembers. If you want to remove Parts completely from a Diagram, call Diagram#removeParts.

This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @param {Iterable.

Implementation

_i2.bool addTopLevelParts(
  _i3.Iterable<_i3.Part> coll, [
  _i2.bool? check,
]) =>
    _i4.callMethod(
      this,
      'addTopLevelParts',
      [
        coll,
        check ?? _i5.undefined,
      ],
    );