(name, oldValue, newValue)
| 390 | } |
| 391 | |
| 392 | attributeChangedCallback(name, oldValue, newValue) { |
| 393 | // console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue); |
| 394 | // "Best practice": handle side-effects in this callback |
| 395 | // https://developers.google.com/web/fundamentals/web-components/best-practices |
| 396 | // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy |
| 397 | // note that the example is misleading, since the user can't use |
| 398 | // setAttribute or removeAttribute to set the property, they need to use |
| 399 | // the property directly in their API usage, which kinda sucks |
| 400 | /* |
| 401 | const hasValue = newValue !== null; |
| 402 | switch (name) { |
| 403 | case 'checked': |
| 404 | // Note the attributeChangedCallback is only handling the *side effects* |
| 405 | // of setting the attribute. |
| 406 | this.setAttribute('aria-checked', hasValue); |
| 407 | break; |
| 408 | ... |
| 409 | } */ |
| 410 | switch (name) { |
| 411 | case 'controlslist': |
| 412 | if (this._controlsList) { |
| 413 | if (this._controlsList.valueSet === false) { |
| 414 | this._controlsList.value = newValue; |
| 415 | } |
| 416 | this._toggleControls(); |
| 417 | } |
| 418 | break; |
| 419 | case 'controls': |
| 420 | if (oldValue !== null && newValue === null) { |
| 421 | this._hideControls(); |
| 422 | } else if (oldValue === null && newValue !== null) { |
| 423 | this._showControls(); |
| 424 | } |
| 425 | break; |
| 426 | case 'height': |
| 427 | if (oldValue !== newValue) { |
| 428 | this._changeHeight(newValue); |
| 429 | } |
| 430 | break; |
| 431 | case 'width': |
| 432 | if (oldValue !== newValue) { |
| 433 | this._changeWidth(newValue); |
| 434 | } |
| 435 | break; |
| 436 | case 'static': |
| 437 | this._toggleStatic(); |
| 438 | break; |
| 439 | case 'projection': |
| 440 | const reconnectLayers = () => { |
| 441 | if (this._map && this._map.options.projection !== newValue) { |
| 442 | // save map location and zoom |
| 443 | let lat = this.lat; |
| 444 | let lon = this.lon; |
| 445 | let zoom = this.zoom; |
| 446 | // saving the lat, lon and zoom is necessary because Leaflet seems |
| 447 | // to try to compensate for the change in the scales for each zoom |
| 448 | // level in the crs by changing the zoom level of the map when |
| 449 | // you set the map crs. So, we save the current view for use below |
nothing calls this directly
no test coverage detected