SceneController constructor

SceneController({
  1. Scene? scene,
  2. PointerInputSettings? pointerSettings,
  3. double? dragStartSlop,
  4. NodeId nodeIdGenerator()?,
})

Creates a controller that edits scene.

nodeIdGenerator lets you override how node IDs are produced for nodes created by this controller. By default, IDs are node-{n} with a per-controller counter. The default counter starts at max(existing node-n)+1 for the provided scene to avoid O(N) scans during bulk node creation.

IDs are guaranteed to be unique within the scene at generation time. If you override the generator, ensure IDs stay unique in the scene.

Implementation

SceneController({
  Scene? scene,
  PointerInputSettings? pointerSettings,
  double? dragStartSlop,
  NodeId Function()? nodeIdGenerator,
}) : scene = scene ?? Scene(),
     pointerSettings = pointerSettings ?? const PointerInputSettings(),
     _dragStartSlop = dragStartSlop {
  _nodeIdGenerator = nodeIdGenerator ?? _defaultNodeIdGenerator;
  _nodeIdSeed = _initialDefaultNodeIdSeed(this.scene);
  _repaintScheduler = RepaintScheduler(notifyListeners: notifyListeners);
  _actionDispatcher = ActionDispatcher();
  _selectionModel = SelectionModel();
  _moveModeEngine = MoveModeEngine(_contracts);
  _drawModeEngine = DrawModeEngine(_contracts);
  _sceneCommands = SceneCommands(_contracts);
}