Skip to content

Commit

Permalink
Make execution of map-extent's map-projectionchange handler conditional
Browse files Browse the repository at this point in the history
on the parent layer not being disabled (by a media query). This is a 
break with normal disabled calculation, which for a layer has been 
deduced on the content of the layer being "visible" (within zoom limits, 
map bounds). May break other stuff tbd.
  • Loading branch information
prushforth committed Dec 17, 2024
1 parent 8f40f9b commit 0589bf0
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/map-extent.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,22 +430,27 @@ export class HTMLExtentElement extends HTMLElement {
}

_handleChange() {
// add _extentLayer to map if map-extent is checked, otherwise remove it
if (this.checked && !this.disabled) {
// can be added to mapmllayer layerGroup no matter map-layer is checked or not
this._extentLayer.addTo(this.parentLayer._layer);
this._extentLayer.setZIndex(
Array.from(
this.parentLayer.src
? this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent')
: this.parentLayer.querySelectorAll(':scope > map-extent')
).indexOf(this)
);
} else {
this.parentLayer._layer?.removeLayer(this._extentLayer);
// parent layer can be disabled due to media query
if (!this.parentLayer.disabled) {
// add _extentLayer to map if map-extent is checked, otherwise remove it
if (this.checked && !this.disabled) {
// can be added to mapmllayer layerGroup no matter map-layer is checked or not
this._extentLayer.addTo(this.parentLayer._layer);
this._extentLayer.setZIndex(
Array.from(
this.parentLayer.src
? this.parentLayer.shadowRoot.querySelectorAll(
':host > map-extent'
)
: this.parentLayer.querySelectorAll(':scope > map-extent')
).indexOf(this)
);
} else {
this.parentLayer._layer?.removeLayer(this._extentLayer);
}
// change the checkbox in the layer control to match map-extent.checked
// doesn't trigger the event handler because it's not user-caused AFAICT
}
// change the checkbox in the layer control to match map-extent.checked
// doesn't trigger the event handler because it's not user-caused AFAICT
}
_validateLayerControlContainerHidden() {
let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;
Expand Down

0 comments on commit 0589bf0

Please sign in to comment.