feat: uncluster tracked-station markers and thin overlaps by screen distance #43
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/tracked-station-declutter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When tracking a single station (e.g.
W5ISP-9), every position marker for that station went into the Leaflet cluster group. At zoom < 11 the whole track collapsed into numbered cluster bubbles (4, 9, …) — you saw blobs, not the track.What changed
Client (
map.ts)trackedMarkerLayer— a plainLayerGroupthat never passes throughmarkerClusterGroup. Tracked-station markers route there on add and get re-homed when tracking changes.declutterTrackedMarkers— greedy minimum-distance thinning at 28px screen separation, newest-first so the track head always wins. Overlapping positions are hidden (display:none), not removed: trails, OMS state, and re-show on zoom all keep working. rAF-coalesced; runs onzoomend, marker adds, and tracking changes.callsignandcallsign_group, SSID-flexible in both directions (trackingW5ISPcoversW5ISP-*; trackingW5ISP-9covers theW5ISPgroup).Server (
map_live)set_tracked_callsignonmap_ready, track/clear events, and URL reconcile, so the client knows the tracked callsign before markers arrive.show_trail_linegate widened fromzoom <= 8to< 11so the full track is drawn at zooms 9–10 too; newsync_trail_line_for_zoom/3sends/clears it on boundary crossings (cleared at ≥ 11 where client trails take over).Verified live
Tests
2286/2286 green (map suite 382/382); format + credo --strict + dialyzer clean via pre-commit hooks.
🤖 Skippy PR review
1 finding — 1 blocking before merge.
lib/aprsme_web/live/map_live/events.ex:168Reviewed
4a027d8fe15c. Commentskippy reviewto re-run.@ -161,6 +165,7 @@ defmodule AprsmeWeb.MapLive.Events dosocket|> assign(tracked_callsign: "", other_ssids: [])|> update_url_with_current_state()|> push_event("set_tracked_callsign", %{callsign: ""})🟡 Warning — Clearing the callsign form leaves the trail line drawn at zoom 9-10
Submitting the emptied Track form (
handle_track_callsign("")) clearstracked_callsignand pushesset_tracked_callsign, but unlikehandle_clear_tracking/1andIndex.reconcile_tracked_callsign/4it never pushesclear_trail_line, and the client'ssetTrackedCallsign/1only re-homes markers, so theL.polylinestays on the map.That gap used to self-heal at zoom <= 8 (the next bounds update pushes
show_heat_map, whose handler removesself.trailLine). With the gate widened tozoom < 11it is now permanent in the 9-10 band: a bounds update short-circuits ontracked_callsign == "",sync_trail_line_for_zoom/3returns early on the empty callsign, and nothing above zoom 8 ever pushesshow_heat_map- so panning/zooming 9<->10 keeps a full track drawn for a station the UI reports as untracked (the follow-uppush_patchto/reconciles to the same"", so it clears nothing either).Fix: add the clear beside the new push, matching the other two clear paths:
4a027d8fe1443786d8e5🤖 Skippy PR review
1 finding — 1 blocking before merge.
lib/aprsme_web/live/map_live/bounds_updater.ex:105Resolved 1 earlier finding: the emptied Track form now pushes clear_trail_line beside set_tracked_callsign (with a test). 1 new finding on the widened trail-line gate.
Reviewed
443786d8e5bb. Commentskippy reviewto re-run.@ -103,3 +103,3 @@# historical loader send heat mapsocket =if socket.assigns.tracked_callsign != "" and socket.assigns.map_zoom <= 8 doif socket.assigns.tracked_callsign != "" and socket.assigns.map_zoom < 11 do🟡 Warning — Widened trail-line gate has no data to draw from at zooms 9-10
send_trail_line_for_tracked_callsign/1builds the polyline fromsocket.assigns.visible_packets ++ historical_packets, and neither holds the track at zoom 9-10.visible_packetsis keyed byget_callsign_key/1(display name), so it carries at most ONE packet for the tracked station, andhistorical_packetsis%{}in markers mode:HistoricalLoader.start_progressive_historical_loading/1resets it at the top of every load (both branches) and thezoom > 8clause ofhandle_zoom_based_display/5discards the fetched batches (_historical_packets) after pushing them to the client.Failure path: zoom 8 -> 9 draws the full line from the retained zoom-8 dataset, then the first bounds update at 9 resets
historical_packetsand re-sends a payload whose only point is the single live packet. The client'sshow_trail_linehandler removesself.trailLineBEFORE thevalidPoints.length < 2check, so the track line disappears and stays gone while the user stays in 9-10; entering from 11 never draws it at all.Fix: give the widened gate data - in the markers-mode clause of
handle_zoom_based_display/5, merge the batches intohistorical_packets(bounded, as thezoom <= 8clause does) so 9-10 can build the track - or leave the gate at<= 8. Worth also making the client return before removingself.trailLinewhen the payload has fewer than 2 valid points.443786d8e5fb7c70794cResolved 1 of 1 earlier findings — the widened trail-line gate now has data to draw from:
handle_zoom_based_display/5stores the 9-10 batches inhistorical_packets(bounded byapply_memory_limit/2) and re-sends the trail on the final batch, withmaybe_push_final_trail_line/1covering the packet-cap and empty-drain exits.Nothing new in
443786d8..fb7c7079.