mirror of
https://github.com/smittix/intercept.git
synced 2026-07-24 00:48:11 -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() {
|
function destroy() {
|
||||||
_disconnectSSE();
|
_disconnectSSE();
|
||||||
if (_map) {
|
if (_map) {
|
||||||
|
if (typeof Settings !== 'undefined' && Settings.unregisterMap) Settings.unregisterMap(_map);
|
||||||
_map.remove();
|
_map.remove();
|
||||||
_map = null;
|
_map = null;
|
||||||
}
|
}
|
||||||
@@ -40,10 +41,15 @@ var DroneMode = (function () {
|
|||||||
var mapEl = document.getElementById('droneMainMap');
|
var mapEl = document.getElementById('droneMainMap');
|
||||||
if (!mapEl || typeof L === 'undefined') return;
|
if (!mapEl || typeof L === 'undefined') return;
|
||||||
_map = L.map('droneMainMap', { zoomControl: true }).setView([20, 0], 2);
|
_map = L.map('droneMainMap', { zoomControl: true }).setView([20, 0], 2);
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
if (typeof Settings !== 'undefined' && Settings.createTileLayer) {
|
||||||
attribution: '© OpenStreetMap',
|
Settings.createTileLayer().addTo(_map);
|
||||||
maxZoom: 18,
|
Settings.registerMap(_map);
|
||||||
}).addTo(_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() {
|
function _connectSSE() {
|
||||||
|
|||||||
Reference in New Issue
Block a user