resolveSelection static method

List<DiagramControlHandle> resolveSelection(
  1. Iterable<ResolvedElement> elements, {
  2. required double zoom,
})

Implementation

static List<DiagramControlHandle> resolveSelection(
  Iterable<ResolvedElement> elements, {
  required double zoom,
}) {
  final selection = elements.toList(growable: false);
  if (selection.isEmpty || selection.any((element) => element.isLocked)) {
    return const [];
  }
  if (selection.length == 1) return resolve(selection.single, zoom: zoom);
  if (selection.any(
    (element) =>
        !diagramAllowsTransform(element, DiagramTransformOperation.resize),
  )) {
    return const [];
  }
  return _resizeHandles(
    elementId: '__selection__',
    bounds: DiagramRect.union(selection.map(selectionBoundsFor)),
  );
}