make marker come to front view when clicked
This commit is contained in:
parent
15c8aa1d25
commit
76c871ff39
2 changed files with 18 additions and 1 deletions
|
|
@ -1132,6 +1132,23 @@ let MapAPRSMap = {
|
||||||
// Handle marker click
|
// Handle marker click
|
||||||
marker.on("click", () => {
|
marker.on("click", () => {
|
||||||
if (marker.openPopup) marker.openPopup();
|
if (marker.openPopup) marker.openPopup();
|
||||||
|
|
||||||
|
// Bring the clicked marker to front
|
||||||
|
if (marker.getElement) {
|
||||||
|
const element = marker.getElement();
|
||||||
|
if (element) {
|
||||||
|
// Find the highest z-index among all markers
|
||||||
|
let maxZIndex = 1000;
|
||||||
|
document.querySelectorAll('.leaflet-marker-icon').forEach((el) => {
|
||||||
|
const zIndex = parseInt((el as HTMLElement).style.zIndex || '0', 10);
|
||||||
|
if (zIndex > maxZIndex) maxZIndex = zIndex;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set this marker's z-index higher than all others
|
||||||
|
element.style.zIndex = (maxZIndex + 1).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
safePushEvent(self.pushEvent, "marker_clicked", {
|
safePushEvent(self.pushEvent, "marker_clicked", {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
callsign: data.callsign,
|
callsign: data.callsign,
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ defmodule AprsmeWeb.AprsSymbol do
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border: 1px solid rgba(30, 64, 175, 0.3);
|
border: 1px solid rgba(30, 64, 175, 0.3);
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
pointer-events: none;
|
pointer-events: auto;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
">#{callsign}</div>
|
">#{callsign}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue