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.3 KiB
10 lines
3.3 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/Logger ../../core/accessorSupport/decorators/property ../../core/has ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(c,b,e,d,g,h,f){b=class extends b{constructor(a){super(a);this._vendorInfo=null;this._fullscreenStyle="width: 100%; height: 100%;";this.view=null;this._errorHandler=this._errorHandler.bind(this);this._stateHandler=this._stateHandler.bind(this)}destroy(){this._removeFullscreenListeners(); |
|
this.view=null}get element(){return this.view?.container??null}set element(a){this._override("element",a)}get state(){return this.element?this._isSupported()?this._isActive()?"active":"ready":"feature-unsupported":"disabled"}enter(){this._enterFullscreen()}exit(){this._exitFullscreen()}toggle(){this._isActive()?this._exitFullscreen():this._enterFullscreen()}_isSupported(){this._removeFullscreenListeners();const a=this._getVendorInfo(this.element);this._addFullscreenListeners(a);this._vendorInfo=a; |
|
return!!a}_isActive(){return this._vendorInfo?!!document[this._vendorInfo.propertyName]:!1}_stateHandler(){this.notifyChange("state");"active"===this.state?this._addStyle():this._removeStyle()}_errorHandler(a){e.getLogger(this).error("fullscreen request failed",a)}_getVendorInfo(a){if(a){if(a.requestFullscreen)return{enterName:"requestFullscreen",exitName:"exitFullscreen",errorEventName:"fullscreenerror",changeEventName:"fullscreenchange",propertyName:"fullscreen"};if(a.webkitRequestFullScreen)return{enterName:"webkitRequestFullscreen", |
|
exitName:"webkitCancelFullScreen",errorEventName:"webkitfullscreenerror",changeEventName:"webkitfullscreenchange",propertyName:"webkitIsFullScreen"};if(a.mozRequestFullScreen)return{enterName:"mozRequestFullScreen",exitName:"mozCancelFullScreen",errorEventName:"mozfullscreenerror",changeEventName:"mozfullscreenchange",propertyName:"mozFullScreen"}}}_enterFullscreen(){if("feature-unsupported"===this.state)e.getLogger(this).warn("The fullscreen API is not supported in this browser.");else{var {element:a}= |
|
this;a&&(this._vendorInfo&&a[this._vendorInfo.enterName].call(a),this.notifyChange("state"))}}_addStyle(){const {element:a}=this;a&&a.setAttribute("style",this._fullscreenStyle)}_removeStyle(){const {element:a}=this;a&&a.removeAttribute("style")}_exitFullscreen(){if("feature-unsupported"!==this.state){var {element:a}=this;a&&(this._vendorInfo&&document[this._vendorInfo.exitName].call(document),this.notifyChange("state"))}}_addFullscreenListeners(a){a&&(document.addEventListener(a.changeEventName, |
|
this._stateHandler),document.addEventListener(a.errorEventName,this._errorHandler))}_removeFullscreenListeners(){const {_vendorInfo:a}=this;a&&(document.removeEventListener(a.changeEventName,this._stateHandler),document.removeEventListener(a.errorEventName,this._errorHandler))}};c.__decorate([d.property()],b.prototype,"element",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,"enter", |
|
null);c.__decorate([d.property()],b.prototype,"exit",null);c.__decorate([d.property()],b.prototype,"toggle",null);return b=c.__decorate([f.subclass("esri.widgets.Fullscreen.FullscreenViewModel")],b)}); |