@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.23 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as i}from"tslib";import{property as t,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 s}from"../../animation/pointToPoint/Animation.js";import{AnimationController as r}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 r{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(i){super(i),this.type="point-to-point",this.mode="interaction"}initialize(){this.animation=new s(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new o}get isInteractive(){return"interaction"===this.mode}begin(i,t){this.stepController=(i,t)=>{this.animation.step(i,t),this.animation.finished&&this.finishController()};const n=this.animationSettings(t);p.copyFrom(this.view.state.camera);const e=new m(this.view.state.viewingMode);this._intersectionHelper.intersectRay(p.ray,e,h)&&(p.center=h),this.animation.update(p,i,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(i){this.stepController&&(this.animation.cameraAt(this.animation.currentTime/this.animation.time,i),this.animation.currentTime=this.animation.time),super.onControllerEnd(i),this.stepController=void 0}animationSettings(i={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...i,easing:"string"==typeof i.easing?c[i.easing]:i.easing}}};i([t({constructOnly:!0})],l.prototype,"mode",void 0),i([t({readOnly:!0})],l.prototype,"isInteractive",null),l=i([n("esri.views.3d.state.controllers.PointToPointAnimationController")],l);let p=new a;const h=e();function d(){p=new a}function u(i){return null!=i&&"type"in i&&"point-to-point"===i.type}export{l as PointToPointAnimationController,d as cleanupPointToPointAnimationController,u as isPointToPointAnimationController};