@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.3 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{RotateController as r}from"../../state/controllers/RotateController.js";export{PivotPoint}from"../../state/controllers/RotateController.js";import{InputHandler as e}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as o}from"../../../input/handlers/support.js";class s 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 s=e.data;if(s.pointers.size>1)return;if(!o(e.data,this.pointerActions))return;const a=t(s.center.x,s.center.y);switch(s.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(a);break;case"update":this._cameraController&&this._cameraController.update(a);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}}export{s as DragRotate};