mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 14:11:54 -07:00
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:
@@ -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: '© <a href="https://www.openstreetmap.org/copyright">OSM</a> © <a href="https://carto.com/">CARTO</a>',
|
||||
maxZoom: 19,
|
||||
}).addTo(_map);
|
||||
}
|
||||
}
|
||||
|
||||
function _connectSSE() {
|
||||
|
||||
Reference in New Issue
Block a user