You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
3.2 KiB
10 lines
3.2 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("../../chunks/tslib.es6 ../../core/Accessor ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/accessorSupport/decorators/cast ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ../../geometry/projection ../../geometry/support/spatialReferenceUtils ../../support/basemapUtils".split(" "),function(c,b,h,d,q,t,u,r,k,m,e){b=class extends b{constructor(a){super(a);this._basemapCache={};this._loadingProjectionEngine=!1;this.nextBasemap= |
|
e.ensureType("hybrid",this._basemapCache);this.view=null}initialize(){h.watch(()=>this.nextBasemap,a=>{a&&!a.loaded&&a.load().catch(()=>{})},h.initial)}destroy(){this.view=null;e.destroyCache(this._basemapCache);this._basemapCache=null}get _nextBasemapSpatialReferenceTask(){return e.findSpatialReference(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){const {view:a}=this;return a&&"spatialReferenceLocked"in a?a.spatialReferenceLocked:!0}get activeBasemap(){return e.ensureType(this.view?.map?.basemap?? |
|
"topo-vector",this._basemapCache)}castNextBasemap(a){return e.ensureType(a,this._basemapCache)}get state(){const {view:a}=this;if(!a?.ready||this._nextBasemapSpatialReferenceTask.updating)return"disabled";const {spatialReference:f}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&null!=f&&!a.spatialReference.equals(f)?"incompatible-next-basemap":this._loadingProjectionEngine?"loading":"ready"}async toggle(){const {activeBasemap:a,nextBasemap:f,state:n,view:g}=this;if(g&& |
|
"disabled"!==n&&"incompatible-next-basemap"!==n){var p=this._viewSpatialReferenceLocked;if(!p){await h.whenOnce(()=>!this._nextBasemapSpatialReferenceTask.updating);if(f!==this.nextBasemap||a!==this.activeBasemap)return;const {spatialReference:l}=this._nextBasemapSpatialReferenceTask;null==l||m.equals(g.spatialReference,l)||k.isLoaded()||k.canProjectWithoutEngine(g.spatialReference,l)||(this._loadingProjectionEngine=!0,await k.load(),this._loadingProjectionEngine=!1);if(f!==this.nextBasemap||a!== |
|
this.activeBasemap)return}g.map.basemap=f;p||null==this._nextBasemapSpatialReferenceTask.spatialReference||m.equals(g.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)||(g.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference);this.nextBasemap=a}}static getThumbnailUrl(a){return e.getBasemapThumbnailUrl(a)}};c.__decorate([d.property()],b.prototype,"_loadingProjectionEngine",void 0);c.__decorate([d.property({readOnly:!0})],b.prototype,"_nextBasemapSpatialReferenceTask", |
|
null);c.__decorate([d.property({readOnly:!0})],b.prototype,"_viewSpatialReferenceLocked",null);c.__decorate([d.property({readOnly:!0})],b.prototype,"activeBasemap",null);c.__decorate([d.property()],b.prototype,"nextBasemap",void 0);c.__decorate([q.cast("nextBasemap")],b.prototype,"castNextBasemap",null);c.__decorate([d.property({readOnly:!0})],b.prototype,"state",null);c.__decorate([d.property()],b.prototype,"view",void 0);c.__decorate([d.property()],b.prototype,"toggle",null);return b=c.__decorate([r.subclass("esri.widgets.BasemapToggle.BasemapToggleViewModel")], |
|
b)}); |