addOrUpdate method

void addOrUpdate(
  1. T object
)

Add or update an object in the spatial index

Implementation

void addOrUpdate(T object) {
  _objects[object.id] = object;

  if (_isDragging && _draggingObjectIds.contains(object.id)) {
    // For dragging objects, update immediately
    _updateSpatialIndexForObject(object);
  } else {
    // For non-dragging objects, batch updates for better performance
    _pendingUpdates.add(object.id);
    _processPendingUpdatesIfNeeded();
  }
}