/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{property as i,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../ViewAnimation.js";import{Animation as r}from"../../animation/pointToPoint/Animation.js";import{AnimationController as s}from"./AnimationController.js";import a from"../../webgl/RenderCamera.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as c}from"../../../animation/easing.js";let l=class extends s{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.type="point-to-point",this.mode="interaction",this._target=null}initialize(){this.animation=new r(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new o}get isInteractive(){return"interaction"===this.mode}begin(t,i){this._target=t.clone(),this.stepController=(t,i)=>{this.animation.step(t,i),this.animation.finished&&this.finishController()};const n=this.animationSettings(i);h.copyFrom(this.view.state.camera);const e=new m(this.view.state.viewingMode);this._intersectionHelper.intersectRay(h.ray,e,p)&&(h.center=p),this.animation.update(h,t,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(t){if(this.stepController){this.animation.currentTime/this.animation.time>=1&&this._target?t.copyFrom(this._target):this.animation.cameraAt(this.animation.currentTime/this.animation.time,t),this.animation.currentTime=this.animation.time}super.onControllerEnd(t),this.stepController=void 0}animationSettings(t={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...t,easing:"string"==typeof t.easing?c[t.easing]:t.easing}}};t([i({constructOnly:!0})],l.prototype,"mode",void 0),t([i({readOnly:!0})],l.prototype,"isInteractive",null),l=t([n("esri.views.3d.state.controllers.PointToPointAnimationController")],l);let h=new a;const p=e();function u(){h=new a}function d(t){return null!=t&&"type"in t&&"point-to-point"===t.type}export{l as PointToPointAnimationController,u as cleanupPointToPointAnimationController,d as isPointToPointAnimationController};
