hideDeeperThan static method
Hides any levels deeper than level for the given rootId, and hides
any child roots opened from those levels.
Implementation
static void hideDeeperThan(int level, {Object? rootId}) {
final key = rootId ?? _defaultRoot;
final state = _roots[key];
if (state == null) return;
final levels = state.activeByLevel.keys.where((l) => l > level).toList();
for (final l in levels) {
final controller = state.activeByLevel[l];
if (controller != null && controller.isShowing) {
controller.hide();
}
state.activeByLevel.remove(l);
state.hoveredLevels.remove(l);
}
// Hide child roots whose parent is this root
if (levels.isNotEmpty) {
final childRoots = _roots.values.where((r) => r.parentRootId == key).map((r) => r.rootId).toList();
for (final childRoot in childRoots) {
hideRoot(childRoot);
}
}
}