@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 623 B
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{InputHandler as e}from"../../../input/InputHandler.js";const t=.6;class o extends e{constructor(e,t){super(!0),this._view=e,this._canZoom=!0,this.registerIncoming("mouse-wheel",t,e=>this._handleMouseWheel(e))}_handleMouseWheel(e){if("zoom"!==this._view.navigation.actionMap.mouseWheel)return;if(e.preventDefault(),e.stopPropagation(),!this._canZoom)return;const o=this._view.mapViewNavigation,{x:i,y:n,deltaY:s}=e.data,a=1/t**(1/60*s),h=o.zoom(a,[i,n]);this._canZoom=!1,h.catch(()=>{}).then(()=>{this._canZoom=!0,o.end()})}}export{o as MouseWheelZoom};