selectInBounds method

bool selectInBounds(
  1. CanvasBounds bounds
)

Selects all visible objects that intersect or are contained in bounds.

Implementation

bool selectInBounds(CanvasBounds bounds) {
  final ids = <String>[];
  for (final object in _objects) {
    if (object.id == null || object.hidden) continue;
    final objectBounds = _boundsFor(object);
    final intersects = objectBounds.left <= bounds.right &&
        objectBounds.right >= bounds.left &&
        objectBounds.top <= bounds.bottom &&
        objectBounds.bottom >= bounds.top;
    if (intersects) {
      ids.add(object.id!);
    }
  }
  return selectMany(ids);
}