import BaseAnnotationTool from '../base/BaseAnnotationTool.js';

import createNewMeasurement from './bidirectionalTool/createNewMeasurement.js';
import pointNearTool from './bidirectionalTool/pointNearTool.js';
import renderToolData from './bidirectionalTool/renderToolData.js';
import addNewMeasurement from './bidirectionalTool/addNewMeasurement.js';
import _moveCallback from './bidirectionalTool/mouseMoveCallback.js';
import preMouseDownCallback from './bidirectionalTool/preMouseDownCallback.js';
import preTouchStartCallback from './bidirectionalTool/preTouchStartCallback.js';

const emptyLocationCallback = (measurementData, eventData, doneCallback) => doneCallback();

export default class BidirectionalTool extends BaseAnnotationTool {
  constructor (name = 'Bidirectional') {
    const textBoxConfig = '';
    const shadowConfig = '';

    super({
      name,
      supportedInteractionTypes: ['Mouse', 'Touch'],
      configuration: {
        changeMeasurementLocationCallback: emptyLocationCallback,
        textBox: textBoxConfig,
        shadow: shadowConfig,
        distanceThreshold: 28
      }
    });

    this.createNewMeasurement = createNewMeasurement.bind(this);
    this.pointNearTool = pointNearTool.bind(this);
    this.renderToolData = renderToolData.bind(this);
    this.addNewMeasurement = addNewMeasurement.bind(this);
    this._moveCallback = _moveCallback.bind(this);

    this.preMouseDownCallback = preMouseDownCallback.bind(this);
    this.preTouchStartCallback = preTouchStartCallback.bind(this);
  }

}


@@ -759,30 +759,26 @@
 or (
-name = 'Bidirectional'
+configuration = %7B%7D
 ) %7B%0A
@@ -845,26 +845,59 @@
     
-super(%7B%0A      name
+const defaultConfig = %7B%0A      name: 'Bidirectional'
 ,%0A  
@@ -1090,32 +1090,66 @@
 : shadowConfig,%0A
+        drawHandlesOnHover: true,%0A
         distance
@@ -1170,21 +1170,133 @@
       %7D%0A
-
     %7D
+;%0A%0A    const initialConfiguration = Object.assign(defaultConfig, configuration);%0A%0A    super(initialConfiguration
 );%0A%0A    

Fix initial configuration for Bidirectional tool (#686)