UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.37 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as o}from"tslib";import{clamp as i}from"../../core/mathUtils.js";import{watch as t,syncAndInitial as e,sync as n}from"../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../core/accessorSupport/decorators.js";import m from"./PanoramicZoomConditions.js";import{PanoramicZoomManager as s}from"./PanoramicZoomManager.js";import c from"../Zoom/ZoomViewModel.js";let p=class extends c{constructor(o){super({view:o.view,suppressDeprecationWarning:!0}),this.panoramicZoomConditions=new m,this.view=null,this.zoomIn=()=>{this._zoomManager.zoomIn()},this.zoomInFOV=()=>{if(!this.canZoomIn)return;const o=this.view.camera.fov-this.panoramicZoomConditions.zoomFactor;this.zoomTo(o)},this.zoomOut=()=>{this._zoomManager.zoomOut()},this.zoomOutFOV=()=>{if(!this.canZoomOut)return;const o=this.view.camera.fov+this.panoramicZoomConditions.zoomFactor;this.zoomTo(o)},this.zoomTo=o=>{this.view.camera.fov=this.constrainFOV(o),this.view.camera=this.view.camera.clone()},this.panoramicZoomConditions=o.panoramicZoomConditions??this.panoramicZoomConditions,this._zoomManager=new s({viewModel:o.panoramicViewerViewModel,panoramicZoomViewModel:this})}initialize(){this.addHandles([t(()=>[this.view?.ready,this.panoramicZoomConditions],()=>{this.view?.ready&&(this.panoramicZoomConditions.view=this.view,this.zoomTo(this.view.camera.fov))},e),t(()=>[this.panoramicZoomConditions.maxFOV,this.panoramicZoomConditions.minFOV],([o,i])=>{null!=o&&null!=i&&this.zoomTo(this.view.camera.fov)},n)])}get canZoomIn(){return this.panoramicZoomConditions.canZoomIn}get canZoomOut(){return this.panoramicZoomConditions.canZoomOut}get state(){return this.view?.ready?"ready":"disabled"}set panoramicViewerViewModel(o){this._zoomManager.viewModel=o}get panoramicViewerViewModel(){return this._zoomManager.viewModel}constrainFOV(o){const{maxFOV:t,minFOV:e}=this.panoramicZoomConditions;return i(o,e,t)}};o([a()],p.prototype,"_zoomManager",void 0),o([a()],p.prototype,"canZoomIn",null),o([a()],p.prototype,"canZoomOut",null),o([a({type:m})],p.prototype,"panoramicZoomConditions",void 0),o([a()],p.prototype,"state",null),o([a()],p.prototype,"view",void 0),o([a()],p.prototype,"panoramicViewerViewModel",null),p=o([r("esri.widgets.PanoramicViewer.PanoramicZoomViewModel")],p);const h=p;export{h as default};