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>;
|
) => Promise<RouteResult>;
|
||||||
/** Browser-local saved points (selectable as destination). */
|
/** Browser-local saved points (selectable as destination). */
|
||||||
savedPoints?: SavedPoint[];
|
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). */
|
/** Controlled destination (set via the context dialog or the picker). */
|
||||||
destination: { lat: number; lon: number; label?: string } | null;
|
destination: { lat: number; lon: number; label?: string } | null;
|
||||||
/** Called whenever the destination should change. */
|
/** Called whenever the destination should change. */
|
||||||
@ -53,7 +51,6 @@
|
|||||||
computing = false,
|
computing = false,
|
||||||
runRoute,
|
runRoute,
|
||||||
savedPoints = [],
|
savedPoints = [],
|
||||||
onPickSavedPoint,
|
|
||||||
destination = null,
|
destination = null,
|
||||||
onDestinationChange
|
onDestinationChange
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
@ -267,7 +264,7 @@
|
|||||||
{#if savedMatches().length}
|
{#if savedMatches().length}
|
||||||
<li class="sept">Saved points</li>
|
<li class="sept">Saved points</li>
|
||||||
{#each savedMatches() as p (p.id)}
|
{#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)}`}
|
<span class="saved-dot"></span>{p.label || `${p.lat.toFixed(4)}, ${p.lon.toFixed(4)}`}
|
||||||
</button></li>
|
</button></li>
|
||||||
{/each}
|
{/each}
|
||||||
@ -293,7 +290,7 @@
|
|||||||
<div class="dest-saved">
|
<div class="dest-saved">
|
||||||
<span class="sept-label">— or a saved point —</span>
|
<span class="sept-label">— or a saved point —</span>
|
||||||
{#each savedPoints as p (p.id)}
|
{#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)}`}
|
<span class="saved-dot"></span>{p.label || `${p.lat.toFixed(4)}, ${p.lon.toFixed(4)}`}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@ -352,9 +352,6 @@
|
|||||||
}
|
}
|
||||||
function closeContext() { ctx = null; }
|
function closeContext() { ctx = null; }
|
||||||
|
|
||||||
function setSavedPointAsOrigin(p: SavedPoint) {
|
|
||||||
setOrigin(p.lat, p.lon, p.label || 'Saved point');
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- context dialog actions ---
|
// --- context dialog actions ---
|
||||||
function ctxDirectionsFrom(lat: number, lon: number, label?: string) {
|
function ctxDirectionsFrom(lat: number, lon: number, label?: string) {
|
||||||
@ -633,7 +630,6 @@
|
|||||||
graphLoading={routeLoading}
|
graphLoading={routeLoading}
|
||||||
searchables={searchables}
|
searchables={searchables}
|
||||||
savedPoints={savedPointsList}
|
savedPoints={savedPointsList}
|
||||||
onPickSavedPoint={(p) => setSavedPointAsOrigin(p)}
|
|
||||||
destination={destination}
|
destination={destination}
|
||||||
onDestinationChange={(d) => (destination = d)}
|
onDestinationChange={(d) => (destination = d)}
|
||||||
progress={routeProgress}
|
progress={routeProgress}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user