/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{eyeWithinExtent as a}from"../camera/intersectionUtils.js";import{applySurfaceCollisionConstraint as o}from"../camera/constraintUtils/surfaceCollision.js";let s=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.view.elevationProvider.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}_handleElevationChangeEvent(e){if(this.view.state.cameraController||"ground"!==e.context)return;const t=this.view.state.camera;null!=e.spatialReference&&a(this.view,t,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>o(this.view,e,1))}};e([r({constructOnly:!0})],s.prototype,"view",void 0),s=e([i("esri.views.3d.state.SurfaceCollisionConstraint")],s);export{s as SurfaceCollisionConstraint};
