Skip to content

Commit

Permalink
Get the layer container the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
hlfan authored Dec 12, 2024
1 parent 47e252d commit a596f95
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vendor/assets/leaflet/leaflet.osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ L.OSM.TileLayer = L.TileLayer.extend({
if (url) this.schemeClass = isDarkMap ? 'dark' : 'light';
L.TileLayer.prototype.initialize.call(this, url || options.url);
this.on('add', function () {
if (this._container) {
if (this.schemeClass) this._container.classList.add(this.schemeClass);
this._container.style.setProperty('--dark-mode-map-filter', this.options.filter);
if (document.getElementById('map').contains(this._container)) document.querySelector('.key-ui').style.setProperty('--dark-mode-map-filter', this.options.filter);
container = this.getContainer();
if (container) {
if (this.schemeClass) container.classList.add(this.schemeClass);
container.style.setProperty('--dark-mode-map-filter', this.options.filter);
if (document.getElementById('map').contains(container)) document.querySelector('.key-ui').style.setProperty('--dark-mode-map-filter', this.options.filter);
}
});
}
Expand Down

0 comments on commit a596f95

Please sign in to comment.