Agriculture-front-end/public/libs/openlayers/plugins/ol-layerswitcher/3.8.3/ol-layerswitcher.min.js

8 lines
9.1 KiB
JavaScript
Raw Normal View History

2023-06-22 06:50:23 +08:00
/**
* Minified by jsDelivr using Terser v5.3.5.
* Original file: /npm/ol-layerswitcher@3.8.3/dist/ol-layerswitcher.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/control/Control"),require("ol/Observable"),require("ol/layer/Group")):"function"==typeof define&&define.amd?define(["ol/control/Control","ol/Observable","ol/layer/Group"],t):e.LayerSwitcher=t(e.ol.control.Control,e.ol.Observable,e.ol.layer.Group)}(this,(function(e,t,n){"use strict";e="default"in e?e.default:e,n="default"in n?n.default:n;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o="layer-switcher-",a=function(e){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=Object.assign({},e),n=t.tipLabel?t.tipLabel:"Legend",i=t.collapseTipLabel?t.collapseTipLabel:"Collapse legend",r=document.createElement("div"),l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,{element:r,target:t.target}));l.activationMode=t.activationMode||"mouseover",l.startActive=!0===t.startActive;var s=void 0!==t.label?t.label:"",c=void 0!==t.collapseLabel?t.collapseLabel:"»";l.groupSelectStyle=a.getGroupSelectStyle(t.groupSelectStyle),l.reverse=!1!==t.reverse,l.mapListeners=[],l.hiddenClassName="ol-unselectable ol-control layer-switcher",a.isTouchDevice_()&&(l.hiddenClassName+=" touch"),l.shownClassName="shown",r.className=l.hiddenClassName;var u=document.createElement("button");return u.setAttribute("title",n),u.setAttribute("aria-label",n),r.appendChild(u),l.panel=document.createElement("div"),l.panel.className="panel",r.appendChild(l.panel),a.enableTouchScroll_(l.panel),u.textContent=s,r.classList.add(o+"group-select-style-"+l.groupSelectStyle),r.classList.add(o+"activation-mode-"+l.activationMode),"click"===l.activationMode?(r.classList.add("activationModeClick"),l.startActive&&(u.textContent=c,u.setAttribute("title",i),u.setAttribute("aria-label",i)),u.onclick=function(e){var t=e||window.event;l.element.classList.contains(l.shownClassName)?(l.hidePanel(),u.textContent=s,u.setAttribute("title",n),u.setAttribute("aria-label",n)):(l.showPanel(),u.textContent=c,u.setAttribute("title",i),u.setAttribute("aria-label",i)),t.preventDefault()}):(u.onmouseover=function(){l.showPanel()},u.onclick=function(e){var t=e||window.event;l.showPanel(),t.preventDefault()},l.panel.onmouseout=function(e){l.panel.contains(e.relatedTarget)||l.hidePanel()}),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,e),i(a,[{key:"setMap",value:function(e){for(var n=this,i=0;i<this.mapListeners.length;i++)t.unByKey(this.mapListeners[i]);this.mapListeners.length=0,r(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"setMap",this).call(this,e),e&&(this.startActive?this.showPanel():this.renderPanel(),"click"!==this.activationMode&&this.mapListeners.push(e.on("pointerdown",(function(){n.hidePanel()}))))}},{key:"showPanel",value:function(){this.element.classList.contains(this.shownClassName)||(this.element.classList.add(this.shownClassName),this.renderPanel())}},{key:"hidePanel",value:function(){this.element.classList.contains(this.shownClassName)&&this.element.classList.remove(this.shownClassName)}},{key:"renderPanel",value:function(){this.dispatchEvent("render"),a.renderPanel(this.getMap(),this.panel,{groupSelectStyle:this.groupSele
//# sourceMappingURL=/sm/a8622bbe1810de6b4b346bc2467a4728f3b93065d4771c9a5967dd59c70febde.map