/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{FovController as o}from"../../state/controllers/FovController.js";import{ZoomControllerGlobal as r}from"../../state/controllers/ZoomControllerGlobal.js";import{ZoomControllerLocal as e}from"../../state/controllers/ZoomControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as i}from"../../../input/handlers/support.js";class n extends s{constructor(t,o,r){super(!0),this._view=t,this.pointerActions=o,this._fovModifier=r,this.registerIncoming("drag",[r],t=>this._handleZoom(t)),this.registerIncoming("drag",t=>this._handleZoom(t))}_handleZoom(s){const n=s.data;if(n.pointers.size>1)return;if(!i(s.data,this.pointerActions))return;const a=t(n.center.x,n.center.y);switch(n.action){case"start":{this._cameraController?.finish();const t=this._view,i=s.modifiers.has(this._fovModifier);this._cameraController=i?new o({view:t,onStop:()=>this._stopController()}):t.state.isGlobal?new r({view:t}):new e({view:t}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(a);break}case"update":this._cameraController?.update(a);break;case"end":this._cameraController instanceof o?this._cameraController.updateTimeout():this._stopController()}s.stopPropagation()}_stopController(){this._cameraController?.finish(),this._cameraController=null}}export{n as DragZoom};
