internalSelectAnnotation method
void
internalSelectAnnotation(
- String annotationId, {
- bool toggle = false,
})
Implementation
void internalSelectAnnotation(String annotationId, {bool toggle = false}) {
runInAction(() {
if (toggle) {
if (_selectedAnnotationIds.contains(annotationId)) {
_selectedAnnotationIds.remove(annotationId);
final annotation = _annotations[annotationId];
if (annotation != null) {
annotation.setSelected(false);
}
} else {
_selectedAnnotationIds.add(annotationId);
final annotation = _annotations[annotationId];
if (annotation != null) {
annotation.setSelected(true);
}
// Note: Removed auto-bring-to-front to allow manual z-index management
}
} else {
// Clear previous annotation selections
for (final id in _selectedAnnotationIds) {
final annotation = _annotations[id];
if (annotation != null) {
annotation.setSelected(false);
}
}
_selectedAnnotationIds.clear();
_selectedAnnotationIds.add(annotationId);
final annotation = _annotations[annotationId];
if (annotation != null) {
annotation.setSelected(true);
}
// IMPORTANT: Clear nodes and connections when selecting annotation (unified selection)
_clearNodeAndConnectionSelections();
// NOTE: Auto-bring-to-front removed to preserve manual z-index management
// Previously would set annotation.setZIndex(_annotations.length) here
}
});
}