Skip to content

Commit edf3689

Browse files
committed
Fix moving waypoint of a line (#326)
1 parent 7421c02 commit edf3689

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

frontend/src/lib/components/route-form/route-form-tab.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { useI18n } from "../../utils/i18n";
99
1010
const context = injectContextRequired();
11+
const mapContext = toRef(() => context.components.map);
1112
const searchBoxContext = requireSearchBoxContext(context);
1213
const i18n = useI18n();
1314
@@ -34,6 +35,14 @@
3435
function activate(): void {
3536
searchBoxContext.value.activateTab(`fm${context.id}-route-form-tab`, { expand: true });
3637
}
38+
39+
function handleHashQueryChange(query: HashQuery | undefined) {
40+
hashQuery.value = query;
41+
42+
if (query) {
43+
mapContext.value?.components.selectionHandler.setSelectedItems([]); // Workaround for now to force route into the hash query
44+
}
45+
}
3746
</script>
3847

3948
<template>
@@ -44,7 +53,7 @@
4453
class="fm-route-form-tab"
4554
>
4655
<template #default="slotProps">
47-
<RouteForm :active="slotProps.isActive" @activate="activate()" ref="routeForm" @hash-query-change="hashQuery = $event"></RouteForm>
56+
<RouteForm :active="slotProps.isActive" @activate="activate()" ref="routeForm" @hash-query-change="handleHashQueryChange($event)"></RouteForm>
4857
</template>
4958
</SearchBoxTab>
5059
</template>

frontend/src/lib/components/route-form/route-form.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,6 @@
420420
reset();
421421
422422
try {
423-
mapContext.value.components.selectionHandler.setSelectedItems([]); // Workaround for now to force route into the hash query
424-
425423
const mode = routeMode.value;
426424
427425
submittedQuery.value = { destinations: cloneDeep(toRaw(destinations.value)), mode };
@@ -451,8 +449,6 @@
451449
452450
async function reroute(zoom: boolean, smooth = true): Promise<void> {
453451
if(hasRoute.value) {
454-
mapContext.value.components.selectionHandler.setSelectedItems([]); // Workaround for now to force route into the hash query
455-
456452
await Promise.all(destinations.value.map((dest) => loadSuggestions(dest)));
457453
const points = destinations.value.map((dest) => getSelectedSuggestion(dest));
458454

0 commit comments

Comments
 (0)