UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 3.89 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import e from"../Viewpoint.js";import{watch as n,sync as i}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import o from"./2d/FrameTask.js";import r from"./2d/MapViewConstraints.js";import{ViewStateManager as l}from"./2d/ViewStateManager.js";import{StationaryManager as p}from"./2d/support/StationaryManager.js";import{ViewEvents as g}from"./input/ViewEvents.js";const h=h=>{const m=h;let d=class extends m{constructor(...t){super(...t),this.fullOpacity=1,this.stateManager=new l({constraints:new r({view:this})}),this.stationaryManager=new p,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!1,labelsAnimationTime:0,labelCollisionsEnabled:!1},this.frameTask=new o(this),this.viewEvents=new g(this),this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([n(()=>this.viewpoint,()=>this.stationaryManager.flip(),i)])}get constraintsInfo(){return{lods:null,spatialReference:null}}get extent(){return this.stateManager?.extent??null}set extent(t){this.stateManager.extent=t}get state(){return this.stateManager.state}get interacting(){return!1}get stationary(){return!this.animation&&this.stationaryManager.stationary}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),t!==this.animationManager.animation&&this.animationManager.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t);const n=()=>{this.destroyed||t===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame())};t.when(n,n)}get canZoomIn(){if(!this.ready)return!1;const t=this.constraints?.effectiveMaxScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n>t}get canZoomOut(){if(!this.ready)return!1;const t=this.constraints?.effectiveMinScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n<t}get constraints(){return this.stateManager?.constraints}set constraints(t){t.view=this;const e=this.stateManager.constraints;this.stateManager.constraints=t,e?.destroy()}get padding(){return this.stateManager?.padding}set padding(t){this.stateManager&&(this.stateManager.padding=t)}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(t){this.stateManager.resizeAlign=t}get rotation(){return this.stateManager.rotation??0}set rotation(t){const{rotationEnabled:e}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=t,this.constraints.rotationEnabled=e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(t){this.stateManager.viewpoint=t,this.frameTask.requestFrame()}async zoomIn(){if(this.canZoomIn)return this.mapViewNavigation.zoomIn()}async zoomOut(){if(this.canZoomOut)return this.mapViewNavigation.zoomOut()}};return t([a({readOnly:!0})],d.prototype,"animationManager",void 0),t([a({readOnly:!0})],d.prototype,"fullOpacity",void 0),t([a()],d.prototype,"stateManager",void 0),t([a()],d.prototype,"constraintsInfo",null),t([a()],d.prototype,"extent",null),t([a({readOnly:!0})],d.prototype,"state",null),t([a({readOnly:!0})],d.prototype,"mapViewNavigation",void 0),t([a()],d.prototype,"renderingOptions",void 0),t([a({readOnly:!0})],d.prototype,"interacting",null),t([a()],d.prototype,"stationary",null),t([a()],d.prototype,"animation",null),t([a({readOnly:!0})],d.prototype,"canZoomIn",null),t([a({readOnly:!0})],d.prototype,"canZoomOut",null),t([a({type:r})],d.prototype,"constraints",null),t([a()],d.prototype,"padding",null),t([a()],d.prototype,"resizeAlign",null),t([a()],d.prototype,"rotation",null),t([a({readOnly:!0})],d.prototype,"viewEvents",void 0),t([a({type:e})],d.prototype,"viewpoint",null),d=t([s("esri.views.Viewport2DBaseMixin")],d),d};export{h as Viewport2DBaseMixin};