fix(ft map): the hover label came back
The invisible circle that catches the clicks sits ON TOP of the dot, so it takes the hover as well — and the tooltip was bound only to the dot underneath. From the moment the stations became clickable, pointing at one said nothing: the callsign, square and report an operator reads off the map had simply gone.
This commit is contained in:
@@ -164,15 +164,21 @@ export function FTMapPanel({ decodes, myGrid, onSelect, onCall }: {
|
||||
L.polyline(pts as L.LatLngExpression[][], {
|
||||
color: colour, weight: 1.3, opacity: 0.65 * fade, smoothFactor: 0,
|
||||
}).addTo(layer);
|
||||
const label = `${d.call} · ${d.grid} · ${d.snr > 0 ? '+' : ''}${d.snr} dB`;
|
||||
const mk = L.circleMarker([to.lat, to.lon], {
|
||||
// A three-pixel dot is a fine mark and a poor target, so the visible
|
||||
// radius stays and an invisible one twice the size takes the clicks.
|
||||
// radius stays and an invisible one three times the size takes the
|
||||
// clicks.
|
||||
radius: 3, color: colour, weight: 1, fillColor: colour, fillOpacity: 0.9 * fade,
|
||||
}).bindTooltip(`${d.call} · ${d.grid} · ${d.snr > 0 ? '+' : ''}${d.snr} dB`, { direction: 'top' })
|
||||
.addTo(layer);
|
||||
}).bindTooltip(label, { direction: 'top' }).addTo(layer);
|
||||
// The tooltip goes on the HIT circle too, and it is the one that matters:
|
||||
// being on top, it takes the hover as well as the click, and binding it
|
||||
// only to the dot underneath left the map silent from the moment the dots
|
||||
// became clickable — the callsign and report an operator reads by pointing
|
||||
// at a station had simply gone.
|
||||
const hit = L.circleMarker([to.lat, to.lon], {
|
||||
radius: 9, opacity: 0, fillOpacity: 0, interactive: true,
|
||||
}).addTo(layer);
|
||||
}).bindTooltip(label, { direction: 'top' }).addTo(layer);
|
||||
for (const target of [mk, hit]) {
|
||||
target.on('click', (e) => {
|
||||
// Not to the map: a click on a station is not a click on the water.
|
||||
|
||||
Reference in New Issue
Block a user