fix(drone): use Settings tile layer for theme-aware map

Replace hardcoded OSM tiles with Settings.createTileLayer() + registerMap()
so the drone map respects the user's map theme preference and switches
automatically with light/dark theme changes. Falls back to CartoDB dark_all
if Settings is unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
James Smith
2026-05-13 09:58:04 +01:00
parent 3554817f91
commit e397a69dae
+10 -4
View File
@@ -23,6 +23,7 @@ var DroneMode = (function () {
function destroy() {
_disconnectSSE();
if (_map) {
if (typeof Settings !== 'undefined' && Settings.unregisterMap) Settings.unregisterMap(_map);
_map.remove();
_map = null;
}
@@ -40,10 +41,15 @@ var DroneMode = (function () {
var mapEl = document.getElementById('droneMainMap');
if (!mapEl || typeof L === 'undefined') return;
_map = L.map('droneMainMap', { zoomControl: true }).setView([20, 0], 2);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap',
maxZoom: 18,
}).addTo(_map);
if (typeof Settings !== 'undefined' && Settings.createTileLayer) {
Settings.createTileLayer().addTo(_map);
Settings.registerMap(_map);
} else {
L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OSM</a> &copy; <a href="https://carto.com/">CARTO</a>',
maxZoom: 19,
}).addTo(_map);
}
}
function _connectSSE() {