From 6462acffc6a7f076684ceb3aeb2318a8e244c23b Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 25 Apr 2026 17:37:17 -0500 Subject: [PATCH] feat(rover): default 50mi max distance and frame map to that radius --- assets/js/rover_map_hook.ts | 12 ++++++++++-- lib/microwaveprop_web/live/rover_live.ex | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/js/rover_map_hook.ts b/assets/js/rover_map_hook.ts index e87c8281..2925c11e 100644 --- a/assets/js/rover_map_hook.ts +++ b/assets/js/rover_map_hook.ts @@ -152,6 +152,10 @@ export const RoverMap: Partial = { fill: false }).addTo(map) + // Frame the initial view around the drive-radius circle so the + // user starts zoomed in at the configured max-distance level. + map.fitBounds(this.driveCircle.getBounds(), { padding: [20, 20] }) + L.control.scale({ metric: false, imperial: true, position: "bottomleft" }).addTo(map) // Render initial stations from data attribute @@ -189,8 +193,12 @@ export const RoverMap: Partial = { this.homeLat = lat this.homeLon = lon if (this.homeMarker) this.homeMarker.setLatLng([lat, lon]) - if (this.driveCircle) this.driveCircle.setLatLng([lat, lon]) - this.map.flyTo([lat, lon], Math.max(this.map.getZoom(), 8), { duration: 0.6 }) + if (this.driveCircle) { + this.driveCircle.setLatLng([lat, lon]) + this.map.flyToBounds(this.driveCircle.getBounds(), { padding: [20, 20], duration: 0.6 }) + } else { + this.map.flyTo([lat, lon], Math.max(this.map.getZoom(), 8), { duration: 0.6 }) + } }) this.handleEvent("rover_results", ( diff --git a/lib/microwaveprop_web/live/rover_live.ex b/lib/microwaveprop_web/live/rover_live.ex index a6095041..78588d0e 100644 --- a/lib/microwaveprop_web/live/rover_live.ex +++ b/lib/microwaveprop_web/live/rover_live.ex @@ -31,7 +31,7 @@ defmodule MicrowavepropWeb.RoverLive do @default_band 10_000 @default_mode :ssb @default_forecast_hour 0 - @default_max_distance_mi 80 + @default_max_distance_mi 50 @km_per_mi 1.609344 @avg_speed_kmh 65.0