()
| 169 | } |
| 170 | |
| 171 | connectedCallback() { |
| 172 | /* jshint ignore:start */ |
| 173 | this.#hasConnected = true; |
| 174 | /* jshint ignore:end */ |
| 175 | // set the initial zoom of the map when features connected |
| 176 | // used for fallback zoom getter for static features |
| 177 | this._initialZoom = this.getMapEl().zoom; |
| 178 | this._parentEl = |
| 179 | this.parentNode.nodeName === 'MAP-LAYER' || |
| 180 | this.parentNode.nodeName === 'LAYER-' || |
| 181 | this.parentNode.nodeName === 'MAP-LINK' |
| 182 | ? this.parentNode |
| 183 | : this.parentNode.host; |
| 184 | if ( |
| 185 | this.getLayerEl().hasAttribute('data-moving') || |
| 186 | this._parentEl.parentElement?.hasAttribute('data-moving') |
| 187 | ) |
| 188 | return; |
| 189 | if ( |
| 190 | this._parentEl.nodeName === 'MAP-LAYER' || |
| 191 | this._parentEl.nodeName === 'LAYER-' || |
| 192 | this._parentEl.nodeName === 'MAP-LINK' |
| 193 | ) { |
| 194 | this._createOrGetFeatureLayer(); |
| 195 | } |
| 196 | // use observer to monitor the changes in mapFeature's subtree |
| 197 | // (i.e. map-properties, map-featurecaption, map-coordinates) |
| 198 | this._observer = new MutationObserver((mutationList) => { |
| 199 | for (let mutation of mutationList) { |
| 200 | // the attributes changes of <map-feature> element should be handled by attributeChangedCallback() |
| 201 | if (mutation.type === 'attributes' && mutation.target === this) { |
| 202 | return; |
| 203 | } |
| 204 | // re-render feature if there is any observed change |
| 205 | this.reRender(this._featureLayer); |
| 206 | } |
| 207 | }); |
| 208 | this._observer.observe(this, { |
| 209 | childList: true, |
| 210 | subtree: true, |
| 211 | attributes: true, |
| 212 | attributeOldValue: true, |
| 213 | characterData: true |
| 214 | }); |
| 215 | } |
| 216 | |
| 217 | disconnectedCallback() { |
| 218 | if ( |
nothing calls this directly
no test coverage detected