Skip to content

Commit

Permalink
Add Leaflet attribution control
Browse files Browse the repository at this point in the history
  • Loading branch information
fodor0205 authored and lionkmp committed May 4, 2024
1 parent d66c8ae commit ed06368
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UrlParamChangeNotifier from '../url/UrlParamChangeNotifier';

import BaseLayers from './BaseLayers';
import Overlays from './Overlays';
import AttributionControl from './controls/AttributionControl';
import ZoomControl from './controls/ZoomControl';
import LocateControl from './controls/LocateControl';
import ScaleControl from './controls/ScaleControl';
Expand All @@ -34,6 +35,7 @@ export default class Map {

this.map = L.map(mapContainerHtmlElementId, {
zoomControl: false,
attributionControl: false,
});

this.id = mapContainerHtmlElementId;
Expand All @@ -50,6 +52,8 @@ export default class Map {

this.map.addControl(new ScaleControl().getMapControl());

this.map.addControl(new AttributionControl().getMapControl());

this.map.addControl(new LoadingIndicatorControl().getMapControl());

// Create map controls for layers and overlays
Expand Down
13 changes: 13 additions & 0 deletions js/map/controls/AttributionControl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import L from 'leaflet';

import MapControl from './MapControl';

export default class AttributionControl extends MapControl {
constructor() {
const attributionControl = L.control.attribution({
prefix: '<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">Leaflet</a>',
});

super(attributionControl);
}
}

0 comments on commit ed06368

Please sign in to comment.