@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 920 B
JavaScript
import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{ZoomStepController as t}from"../../state/controllers/global/ZoomStepController.js";import{ZoomStepController as o}from"../../state/controllers/local/ZoomStepController.js";import{InputHandler as r}from"../../../input/InputHandler.js";class i extends r{constructor(e,t){super(!0),this._view=e,this.registerIncoming("mouse-wheel",t,(e=>this._handleMouseWheel(e)))}_handleMouseWheel(r){if(!this._view.navigation.mouseWheelZoomEnabled)return;const i=r.data;this._cameraController&&this._cameraController.active||(this._cameraController=this._view.state.isGlobal?new t({view:this._view,mode:"interaction"}):new o({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._cameraController)),this._cameraController.zoomStep(-1/60*i.deltaY,e(i.x,i.y)),r.preventDefault(),r.stopPropagation()}}export{i as MouseWheelZoom};