InteractiveAddingToolState constructor

InteractiveAddingToolState(
  1. DrawingToolConfig addingTool, {
  2. required InteractiveLayerBehaviour interactiveLayerBehaviour,
})

Initializes the state with the interactive layer and the addingTool.

The addingTool parameter specifies the configuration for the type of drawing tool that will be created when the user taps on the chart.

The interactiveLayer parameter is passed to the superclass and provides access to the layer's methods and properties.

Implementation

InteractiveAddingToolState(
  this.addingTool, {
  required super.interactiveLayerBehaviour,
}) {
  _drawingPreview ??= interactiveLayerBehaviour.getAddingDrawingPreview(
    addingTool.getInteractableDrawing(
      interactiveLayerBehaviour.interactiveLayer.drawingContext,
      interactiveLayerBehaviour.getToolState,
    ),
    _onAddingStateChange,
  );
}