UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.14 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{RotateController as r}from"../../state/controllers/RotateController.js";import{InputHandler as e}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as o}from"../../../input/handlers/support.js";class a extends e{constructor(t,r,e,o){super(!0),this._view=t,this.pointerActions=r,this._pivot=e,this.registerIncoming("drag",o,t=>this._handleDrag(t))}_handleDrag(e){const a=e.data;if(a.pointers.size>1)return;if(!o(e.data,this.pointerActions))return;const s=t(a.center.x,a.center.y);switch(a.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._cameraController=new r({view:this._view,pivot:this._pivot}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(s);break;case"update":this._cameraController&&this._cameraController.update(s);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}}export{a as DragRotate};