Skip to content

Commit

Permalink
add scale
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Jan 25, 2025
1 parent 9593a86 commit 23e2da9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,27 @@
center: [14.436035, 50.078292],
});
map.showTileBoundaries = false;

// Add scale control with inverted colors
const scale = new maplibregl.ScaleControl({
maxWidth: 80,
unit: 'metric'
});

// Add custom CSS for the scale control
const style = document.createElement('style');
style.textContent = `
.maplibregl-ctrl.maplibregl-ctrl-scale {
background-color: rgba(0,0,0,0.5);
color: #ffffff;
border: 1px solid #ffffff;
border-top: none;
}
`;
document.head.appendChild(style);
map.addControl(scale);


map.on('load', function () {
map.addSource('buildings-source', {
type: 'vector',
Expand Down

0 comments on commit 23e2da9

Please sign in to comment.