mirror of
https://github.com/smittix/intercept.git
synced 2026-07-02 23:08:59 -07:00
feat: add graticule toggle control to all Leaflet maps
Adds a bottomleft grid button (MapUtils.addGraticuleControl) to every map in the app — Meshtastic, MeshCore, Drone, SSTV/ISS, BT Locate, WebSDR, and Weather Satellite — defaulting to visible. The weather satellite map's bespoke addStyledGridOverlay() is removed in favour of the shared implementation. Also updates map-utils.css with button styles and map-utils.js with the new addGraticuleControl() method. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,9 +16,9 @@ const Meshtastic = (function() {
|
||||
|
||||
// Map state
|
||||
let meshMap = null;
|
||||
let meshMarkers = {}; // nodeId -> marker
|
||||
let localNodeId = null;
|
||||
let clickDelegationAttached = false;
|
||||
let meshMarkers = {}; // nodeId -> marker
|
||||
let localNodeId = null;
|
||||
let clickDelegationAttached = false;
|
||||
|
||||
/**
|
||||
* Initialize the Meshtastic mode
|
||||
@@ -33,14 +33,14 @@ const Meshtastic = (function() {
|
||||
/**
|
||||
* Setup event delegation for dynamically created elements
|
||||
*/
|
||||
function setupEventDelegation() {
|
||||
if (clickDelegationAttached) return;
|
||||
clickDelegationAttached = true;
|
||||
|
||||
// Handle button clicks in Leaflet popups and elsewhere
|
||||
document.addEventListener('click', function(e) {
|
||||
const tracerouteBtn = e.target.closest('.mesh-traceroute-btn');
|
||||
if (tracerouteBtn) {
|
||||
function setupEventDelegation() {
|
||||
if (clickDelegationAttached) return;
|
||||
clickDelegationAttached = true;
|
||||
|
||||
// Handle button clicks in Leaflet popups and elsewhere
|
||||
document.addEventListener('click', function(e) {
|
||||
const tracerouteBtn = e.target.closest('.mesh-traceroute-btn');
|
||||
if (tracerouteBtn) {
|
||||
const nodeId = tracerouteBtn.dataset.nodeId;
|
||||
if (nodeId) {
|
||||
sendTraceroute(nodeId);
|
||||
@@ -137,6 +137,8 @@ const Meshtastic = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof MapUtils !== 'undefined') MapUtils.addGraticuleControl(meshMap);
|
||||
|
||||
// Handle resize
|
||||
setTimeout(() => {
|
||||
if (meshMap) meshMap.invalidateSize();
|
||||
|
||||
Reference in New Issue
Block a user