Skip to content

Commit

Permalink
zoom map text
Browse files Browse the repository at this point in the history
  • Loading branch information
antihax committed Jan 1, 2023
1 parent 9d3c699 commit 2c427af
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/leaflet.atlasgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ L.AtlasGrid = L.LayerGroup.extend({

onAdd: function (map) {
this._map = map;

// zoom map text
map.on('zoomend', function () {
let gridHeader = document.querySelectorAll('.leaflet-grid-header');
if (gridHeader) {
let size = 7 + map.getZoom() * 2.5;
for (let i = 0; i < gridHeader.length; ++i) {
gridHeader[i].style.fontSize = size + 'px';
}
}
});

let bounds = map._originalBounds;
this._xTickSize = (bounds.getEast() - bounds.getWest()) / this.options.xticks;
this._yTickSize = (bounds.getSouth() - bounds.getNorth()) / this.options.yticks;
Expand Down Expand Up @@ -177,7 +189,7 @@ L.AtlasGrid = L.LayerGroup.extend({
break;
}

let text = `<div><div class="leaflet-grid-header">${grid}</div> <div class="leaflet-grid-icon">${serverType}</div>`;
let text = `<div><div class="leaflet-grid-header">${grid}</div> <div class="leaflet-grid-header leaflet-grid-icon">${serverType}</div>`;
let tooltip = L.marker(
[bounds.getWest() + this._yTickSize * y, bounds.getNorth() + this._xTickSize * x],
{
Expand Down

0 comments on commit 2c427af

Please sign in to comment.