-
@@ -412,6 +491,58 @@ function toggleFullscreen() {
}
}
+// Global variable to track if callsign labels are shown
+let callsignLabelsVisible = false;
+let callsignLabels = [];
+
+function toggleCallsignLabels() {
+ const button = document.getElementById('callsign-labels-btn');
+
+ if (!callsignLabelsVisible) {
+ // Show callsign labels
+ if (typeof plotlayers !== 'undefined' && plotlayers.length > 0) {
+ plotlayers.forEach(function(marker) {
+ if (marker.data && (marker.data.callsign || marker.data.label)) {
+ // Use callsign if available, otherwise fall back to label
+ const callsign = marker.data.callsign || marker.data.label;
+
+ // Try a different approach - create a DivIcon instead of tooltip
+ const labelIcon = L.divIcon({
+ className: 'callsign-label-icon',
+ html: `
${callsign}
`,
+ iconSize: [0, 0], // No fixed size, let CSS handle it
+ iconAnchor: [0, -5] // Position above the marker with minimal offset
+ });
+
+ // Create a separate marker for the label
+ const labelMarker = L.marker(marker.getLatLng(), {
+ icon: labelIcon,
+ interactive: false,
+ zIndexOffset: 1000
+ });
+
+ map.addLayer(labelMarker);
+ callsignLabels.push(labelMarker);
+ }
+ });
+
+ callsignLabelsVisible = true;
+ button.classList.remove('btn-outline-success');
+ button.classList.add('btn-success');
+ }
+ } else {
+ // Hide callsign labels
+ callsignLabels.forEach(function(labelMarker) {
+ map.removeLayer(labelMarker);
+ });
+
+ callsignLabels = [];
+ callsignLabelsVisible = false;
+ button.classList.remove('btn-success');
+ button.classList.add('btn-outline-success');
+ }
+}
+
// Update statistics when map loads
function updateMapStatistics(plotjson) {
if (plotjson && plotjson.markers) {
@@ -448,6 +579,16 @@ function updateMapStatistics(plotjson) {
mapStatusElement.classList.add('d-none');
}, 3000);
}
+
+ // Reapply callsign labels if they were previously enabled
+ if (callsignLabelsVisible) {
+ // Reset state and toggle to reapply labels to new markers
+ callsignLabelsVisible = false;
+ callsignLabels = [];
+ setTimeout(() => {
+ toggleCallsignLabels();
+ }, 100); // Small delay to ensure markers are fully rendered
+ }
}
}
\ No newline at end of file