feat(rover): default 50mi max distance and frame map to that radius
This commit is contained in:
parent
083c393bc8
commit
6462acffc6
2 changed files with 11 additions and 3 deletions
|
|
@ -152,6 +152,10 @@ export const RoverMap: Partial<RoverMapHook> = {
|
||||||
fill: false
|
fill: false
|
||||||
}).addTo(map)
|
}).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)
|
L.control.scale({ metric: false, imperial: true, position: "bottomleft" }).addTo(map)
|
||||||
|
|
||||||
// Render initial stations from data attribute
|
// Render initial stations from data attribute
|
||||||
|
|
@ -189,8 +193,12 @@ export const RoverMap: Partial<RoverMapHook> = {
|
||||||
this.homeLat = lat
|
this.homeLat = lat
|
||||||
this.homeLon = lon
|
this.homeLon = lon
|
||||||
if (this.homeMarker) this.homeMarker.setLatLng([lat, lon])
|
if (this.homeMarker) this.homeMarker.setLatLng([lat, lon])
|
||||||
if (this.driveCircle) this.driveCircle.setLatLng([lat, lon])
|
if (this.driveCircle) {
|
||||||
this.map.flyTo([lat, lon], Math.max(this.map.getZoom(), 8), { duration: 0.6 })
|
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", (
|
this.handleEvent("rover_results", (
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ defmodule MicrowavepropWeb.RoverLive do
|
||||||
@default_band 10_000
|
@default_band 10_000
|
||||||
@default_mode :ssb
|
@default_mode :ssb
|
||||||
@default_forecast_hour 0
|
@default_forecast_hour 0
|
||||||
@default_max_distance_mi 80
|
@default_max_distance_mi 50
|
||||||
@km_per_mi 1.609344
|
@km_per_mi 1.609344
|
||||||
@avg_speed_kmh 65.0
|
@avg_speed_kmh 65.0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue