mutate method
Runs fn to mutate scene and schedules the appropriate updates.
Prefer this helper over touching scene.layers directly:
- When
structuralis true (add/remove/reorder nodes/layers), this calls notifySceneChanged to restore minimal invariants (e.g. selection). - When
structuralis false (geometry-only changes), this schedules a repaint once per frame.
Implementation
void mutate(void Function(Scene scene) fn, {bool structural = false}) {
_sceneCommands.mutate(fn, structural: structural);
}