UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.66 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{eyeWithinExtent as o}from"../../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as s,Mode as a}from"../../camera/constraintUtils/surfaceCollision.js";import{CameraController as i,State as n}from"./CameraController.js";let l=class extends i{set desiredCamera(e){this._set("desiredCamera",e.clone())}constructor(e){super(e)}get canStop(){return!0}get constraintEnabled(){return this.view.state.constraints.collision.enabled}onControllerStart(){this.state=n.Running,this.addHandles(this.view.basemapTerrain.on("elevation-change",(e=>this._handleElevationChangeEvent(e)))),this._applyCorrection()}onControllerEnd(){this.removeAllHandles()}stepController(){}_handleElevationChangeEvent(e){(null==e.spatialReference||o(this.view,this.desiredCamera,e.extent,e.spatialReference))&&this._applyCorrection()}_applyCorrection(){this.view.state.updateCamera((e=>{e.copyViewFrom(this.desiredCamera),s(this.view,e,a.EYE_AND_CENTER)||this.constraintEnabled||(this.state=n.Stopped)}))}};e([t({constructOnly:!0})],l.prototype,"desiredCamera",null),l=e([r("esri.views.3d.state.controllers.SurfaceCollisionCorrectionController")],l);export{l as SurfaceCollisionCorrectionController};