rebuildFromAnnotations method

void rebuildFromAnnotations(
  1. Iterable<Annotation> annotations
)

Rebuilds only annotations from the given iterable.

Implementation

void rebuildFromAnnotations(Iterable<Annotation> annotations) {
  // Clear existing annotations
  for (final annotationId in _annotations.keys.toList()) {
    _grid.remove(
      AnnotationSpatialItem(annotationId: annotationId, bounds: Rect.zero).id,
    );
  }
  _annotations.clear();

  // Add new annotations
  batch(() {
    for (final annotation in annotations) {
      updateAnnotation(annotation);
    }
  });
}