fix(directions): selecting a saved point as destination no longer re-sets the origin (remove leftover onPickSavedPoint callback)
All checks were successful
CI / test-and-build (push) Successful in 42s
All checks were successful
CI / test-and-build (push) Successful in 42s
This commit is contained in:
parent
c3e3617794
commit
000b892202
@ -33,8 +33,6 @@
|
||||
) => Promise<RouteResult>;
|
||||
/** Browser-local saved points (selectable as destination). */
|
||||
savedPoints?: SavedPoint[];
|
||||
/** Called when the user picks a saved point as a destination. */
|
||||
onPickSavedPoint?: (p: SavedPoint) => void;
|
||||
/** Controlled destination (set via the context dialog or the picker). */
|
||||
destination: { lat: number; lon: number; label?: string } | null;
|
||||
/** Called whenever the destination should change. */
|
||||
@ -53,7 +51,6 @@
|
||||
computing = false,
|
||||
runRoute,
|
||||
savedPoints = [],
|
||||
onPickSavedPoint,
|
||||
destination = null,
|
||||
onDestinationChange
|
||||
}: Props = $props();
|
||||
@ -267,7 +264,7 @@
|
||||
{#if savedMatches().length}
|
||||
<li class="sept">Saved points</li>
|
||||
{#each savedMatches() as p (p.id)}
|
||||
<li><button type="button" onclick={() => { onPickSavedPoint?.(p); setDestination(p.lat, p.lon, p.label || 'Saved point'); }}>
|
||||
<li><button type="button" onclick={() => setDestination(p.lat, p.lon, p.label || 'Saved point')}>
|
||||
<span class="saved-dot"></span>{p.label || `${p.lat.toFixed(4)}, ${p.lon.toFixed(4)}`}
|
||||
</button></li>
|
||||
{/each}
|
||||
@ -293,7 +290,7 @@
|
||||
<div class="dest-saved">
|
||||
<span class="sept-label">— or a saved point —</span>
|
||||
{#each savedPoints as p (p.id)}
|
||||
<button type="button" class="saved-opt" onclick={() => { onPickSavedPoint?.(p); setDestination(p.lat, p.lon, p.label || 'Saved point'); }}>
|
||||
<button type="button" class="saved-opt" onclick={() => setDestination(p.lat, p.lon, p.label || 'Saved point')}>
|
||||
<span class="saved-dot"></span>{p.label || `${p.lat.toFixed(4)}, ${p.lon.toFixed(4)}`}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
@ -352,9 +352,6 @@
|
||||
}
|
||||
function closeContext() { ctx = null; }
|
||||
|
||||
function setSavedPointAsOrigin(p: SavedPoint) {
|
||||
setOrigin(p.lat, p.lon, p.label || 'Saved point');
|
||||
}
|
||||
|
||||
// --- context dialog actions ---
|
||||
function ctxDirectionsFrom(lat: number, lon: number, label?: string) {
|
||||
@ -633,7 +630,6 @@
|
||||
graphLoading={routeLoading}
|
||||
searchables={searchables}
|
||||
savedPoints={savedPointsList}
|
||||
onPickSavedPoint={(p) => setSavedPointAsOrigin(p)}
|
||||
destination={destination}
|
||||
onDestinationChange={(d) => (destination = d)}
|
||||
progress={routeProgress}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user