()
| 1010 | return isVisible; |
| 1011 | } |
| 1012 | _createSelfOrStyleLink() { |
| 1013 | let layerEl = this.getLayerEl(); |
| 1014 | const changeStyle = function (e) { |
| 1015 | DomEvent.stop(e); |
| 1016 | layerEl.dispatchEvent( |
| 1017 | new CustomEvent('changestyle', { |
| 1018 | detail: { |
| 1019 | src: e.target.getAttribute('data-href') |
| 1020 | } |
| 1021 | }) |
| 1022 | ); |
| 1023 | }; |
| 1024 | |
| 1025 | let styleOption = document.createElement('div'), |
| 1026 | styleOptionInput = styleOption.appendChild( |
| 1027 | document.createElement('input') |
| 1028 | ); |
| 1029 | styleOptionInput.setAttribute('type', 'radio'); |
| 1030 | styleOptionInput.setAttribute('id', 'rad-' + stamp(styleOptionInput)); |
| 1031 | styleOptionInput.setAttribute( |
| 1032 | 'name', |
| 1033 | // grouping radio buttons based on parent layer's style <detail> |
| 1034 | 'styles-' + stamp(styleOption) |
| 1035 | ); |
| 1036 | styleOptionInput.setAttribute('value', this.getAttribute('title')); |
| 1037 | styleOptionInput.setAttribute( |
| 1038 | 'data-href', |
| 1039 | new URL(this.href, this.getBase()).href |
| 1040 | ); |
| 1041 | var styleOptionLabel = styleOption.appendChild( |
| 1042 | document.createElement('label') |
| 1043 | ); |
| 1044 | styleOptionLabel.setAttribute('for', 'rad-' + stamp(styleOptionInput)); |
| 1045 | styleOptionLabel.innerText = this.title; |
| 1046 | if (this.rel === 'style self' || this.rel === 'self style') { |
| 1047 | styleOptionInput.checked = true; |
| 1048 | } |
| 1049 | this._styleOption = styleOption; |
| 1050 | styleOptionInput.addEventListener('click', changeStyle.bind(this)); |
| 1051 | } |
| 1052 | getLayerControlOption() { |
| 1053 | return this._styleOption; |
| 1054 | } |
no test coverage detected