UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.71 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{FovController as t}from"../../state/controllers/FovController.js";import{ZoomStepControllerGlobal as e}from"../../state/controllers/ZoomStepControllerGlobal.js";import{ZoomStepControllerLocal as r}from"../../state/controllers/ZoomStepControllerLocal.js";import{InputHandler as l}from"../../../input/InputHandler.js";class s extends l{constructor(o,t){super(!0),this._view=o,this.registerIncoming("mouse-wheel",[t],o=>this._handleFov(o)),this.registerIncoming("mouse-wheel",o=>this._handleZoom(o))}_handleZoom(t){if(!this._mouseWheelZoomEnabled)return;const l=t.data;this._zoomController?.running||(this._stopFovController(),this._zoomController=this._view.state.isGlobal?new e({view:this._view,mode:"interaction"}):new r({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._zoomController)),this._zoomController.step(-l.deltaY/60,o(l.x,l.y)),t.preventDefault(),t.stopPropagation()}_handleFov(o){this._mouseWheelZoomEnabled&&(this._fovController?.running||(this._zoomController?.finish(),this._fovController?.hideOverlay(),this._fovController=new t({view:this._view,onStop:()=>this._stopFovController()}),this._view.state.switchCameraController(this._fovController),1!==this._fovController.state)?(this._fovController.updateTimeout(),this._fovController.step(o.data.deltaY/20),o.preventDefault(),o.stopPropagation()):this._stopFovController())}get _mouseWheelZoomEnabled(){return"zoom"===this._view.navigation.actionMap.mouseWheel}_stopFovController(){this._fovController?.finish(),this._fovController=null}}export{s as MouseWheelZoom};