1 OSM.MapLibre.CombinedControlGroup = class CombinedControlGroup {
2 constructor(controls) {
3 // array of MapLibre controls
4 this.controls = controls;
5 // DOM containers returned by onAdd()
10 this._container = document.createElement("div");
11 this._container.className = "maplibregl-ctrl maplibregl-ctrl-group";
13 for (const ctrl of this.controls) {
14 const ctrlContainer = ctrl.onAdd(map);
15 this.containers.push(ctrlContainer);
17 // Extract buttons from the control's container and add to our wrapper
18 const buttons = ctrlContainer.querySelectorAll("button");
21 "zoom-out": "dash-lg",
22 "geolocate": "cursor-fill"
25 buttons.forEach(button => {
26 // Find the type of button (zoom-in, zoom-out, etc.) from its class name
27 const match = button.className.match(/maplibregl-ctrl-([\w-]+)/);
29 const type = match[1]; // e.g., "zoom-in"
30 const icon = iconMap[type];
35 .append($("<i>").addClass(`maplibregl-ctrl-icon fs-5 bi bi-${icon}`));
38 this._container.appendChild(button);
42 return this._container;
46 for (const ctrl of this.controls) ctrl.onRemove?.();
48 if (this._container) this._container.remove();
52 OSM.MapLibre.GeolocateControl = class extends maplibregl.GeolocateControl {
53 constructor({ positionOptions = {}, ...options } = {}) {
56 enableHighAccuracy: true,
59 trackUserLocation: true,
65 OSM.MapLibre.NavigationControl = class extends maplibregl.NavigationControl {
66 constructor(options = {}) {