MediaLayer.js 1.8 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import o from"../core/Logger.js";import{unwrap as t}from"../core/maybe.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as i}from"../core/accessorSupport/decorators/cast.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import c from"./Layer.js";import{BlendLayer as l}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as p}from"./mixins/ScaleRangeLayer.js";import n from"./support/LocalMediaElementSource.js";let u=class extends(l(p(c))){constructor(e){super(e),this.copyright=null,this.spatialReference=null,this.type="media",this.source=new n}load(e){this.spatialReference&&(this.source.spatialReference=this.spatialReference);const r=this.source.load(e).then((()=>{this.spatialReference=this.source.spatialReference}));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){t(this.source)?.destroy()}get fullExtent(){return this.source?.fullExtent}set source(e){"not-loaded"===this.loadStatus?this._set("source",e):o.getLogger(this.declaredClass).error("#source","source cannot be changed after the layer is loaded.")}castSource(e){return e?Array.isArray(e)||e instanceof r?new n({elements:e}):e:null}};e([s({type:String})],u.prototype,"copyright",void 0),e([s({readOnly:!0})],u.prototype,"fullExtent",null),e([s({type:["show","hide"]})],u.prototype,"listMode",void 0),e([s({nonNullable:!0})],u.prototype,"source",null),e([i("source")],u.prototype,"castSource",null),e([s()],u.prototype,"spatialReference",void 0),e([s({readOnly:!0})],u.prototype,"type",void 0),u=e([a("esri.layers.MediaLayer")],u);const d=u;export{d as default};