UX: searching will unlock the GPS and cancel 'move to gps' if still waiting for a fix

This commit is contained in:
Pieter Vander Vennet 2024-02-03 14:48:32 +01:00
parent e3dec8aafa
commit aea9aeec21
3 changed files with 7 additions and 0 deletions

View file

@ -11,11 +11,13 @@
import { placeholder } from "../../Utils/placeholder" import { placeholder } from "../../Utils/placeholder"
import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid" import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid"
import { ariaLabel } from "../../Utils/ariaLabel" import { ariaLabel } from "../../Utils/ariaLabel"
import { GeoLocationState } from "../../Logic/State/GeoLocationState"
export let perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer> | undefined = undefined export let perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer> | undefined = undefined
export let bounds: UIEventSource<BBox> export let bounds: UIEventSource<BBox>
export let selectedElement: UIEventSource<Feature> | undefined = undefined export let selectedElement: UIEventSource<Feature> | undefined = undefined
export let geolocationState: GeoLocationState | undefined = undefined
export let clearAfterView: boolean = true export let clearAfterView: boolean = true
let searchContents: string = "" let searchContents: string = ""
export let triggerSearch: UIEventSource<any> = new UIEventSource<any>(undefined) export let triggerSearch: UIEventSource<any> = new UIEventSource<any>(undefined)
@ -55,6 +57,8 @@
async function performSearch() { async function performSearch() {
try { try {
isRunning = true isRunning = true
geolocationState?.allowMoving.setData(true)
geolocationState?.requestMoment.setData(undefined) // If the GPS is still searching for a fix, we say that we don't want tozoom to it anymore
searchContents = searchContents?.trim() ?? "" searchContents = searchContents?.trim() ?? ""
if (searchContents === "") { if (searchContents === "") {

View file

@ -113,6 +113,7 @@
perLayer={state.perLayer} perLayer={state.perLayer}
{selectedElement} {selectedElement}
{triggerSearch} {triggerSearch}
geolocationState={state.geolocation.geolocationState}
/> />
</div> </div>
<button <button

View file

@ -203,6 +203,8 @@
}} }}
perLayer={state.perLayer} perLayer={state.perLayer}
selectedElement={state.selectedElement} selectedElement={state.selectedElement}
geolocationState={state.geolocation.geolocationState}
/> />
</If> </If>
</div> </div>