import external from './../externalModules.js';
import BaseTool from './base/BaseTool.js';
import zoomUtils from '../util/zoom/index.js';

const { changeViewportScale } = zoomUtils;

/**
 * @public
 * @class ZoomMouseWheelTool
 * @memberof Tools
 *
 * @classdesc Tool for changing magnification with the mouse wheel.
 * @extends Tools.Base.BaseTool
 */
export default class ZoomMouseWheelTool extends BaseTool {
  constructor(configuration = {}) {
    const defaultConfig = {
      name: 'ZoomMouseWheel',
      supportedInteractionTypes: ['MouseWheel'],
      configuration: {
        minScale: 0.25,
        maxScale: 20.0,
        invert: false,
      },
    };
    const initialConfiguration = Object.assign(defaultConfig, configuration);

    super(initialConfiguration);

    this.initialConfiguration = initialConfiguration;
  }

  mouseWheelCallback(evt) {
    const { element, viewport, direction } = evt.detail;
    const { invert, maxScale, minScale } = this.configuration;
    const ticks = (invert ? direction / 4 : -direction / 4) * evt.spinY;

    const updatedViewport = changeViewportScale(viewport, ticks, {
      maxScale,
      minScale,
    });

    external.cornerstone.setViewport(element, updatedViewport);
  }
}

@@ -898,16 +898,23 @@
 irection
+, spinY
  %7D = evt
@@ -1003,17 +1003,16 @@
 ticks = 
-(
 invert ?
@@ -1046,21 +1046,57 @@
  / 4
-) * evt.
+;%0A%0A    console.log(ticks);%0A    console.log(
 spinY
+)
 ;%0A%0A 
@@ -1157,16 +1157,24 @@
 t, ticks
+ * spinY
 , %7B%0A    

Debug spinY