forked from MapComplete/MapComplete
UX: improve move wizard
This commit is contained in:
parent
1208e095cf
commit
b21d7967ab
3 changed files with 43 additions and 20 deletions
|
|
@ -18,10 +18,11 @@
|
||||||
export let selectedElement: UIEventSource<Feature> | undefined = undefined;
|
export let selectedElement: UIEventSource<Feature> | undefined = undefined;
|
||||||
export let selectedLayer: UIEventSource<LayerConfig> | undefined = undefined;
|
export let selectedLayer: UIEventSource<LayerConfig> | undefined = undefined;
|
||||||
|
|
||||||
|
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)
|
||||||
onDestroy(triggerSearch.addCallback(_ => {
|
onDestroy(triggerSearch.addCallback(_ => {
|
||||||
console.log("TriggerRun pinged")
|
|
||||||
performSearch()
|
performSearch()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
@ -76,7 +77,9 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(clearAfterView){
|
||||||
searchContents = ""
|
searchContents = ""
|
||||||
|
}
|
||||||
dispatch("searchIsValid", false)
|
dispatch("searchIsValid", false)
|
||||||
dispatch("searchCompleted")
|
dispatch("searchCompleted")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
import {Square3Stack3dIcon} from "@babeard/svelte-heroicons/solid";
|
||||||
|
import MapControlButton from "../Base/MapControlButton.svelte";
|
||||||
|
import ThemeViewState from "../../Models/ThemeViewState";
|
||||||
|
|
||||||
|
export let state: ThemeViewState
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<MapControlButton on:click={() => state.guistate.backgroundLayerSelectionIsOpened.setData(true)}>
|
||||||
|
<Square3Stack3dIcon class="w-6 h-6"/>
|
||||||
|
</MapControlButton>
|
||||||
|
|
@ -22,6 +22,7 @@ import { MapProperties } from "../../Models/MapProperties"
|
||||||
import LocationInput from "../InputElement/Helpers/LocationInput.svelte"
|
import LocationInput from "../InputElement/Helpers/LocationInput.svelte"
|
||||||
import Geosearch from "../BigComponents/Geosearch.svelte"
|
import Geosearch from "../BigComponents/Geosearch.svelte"
|
||||||
import Constants from "../../Models/Constants"
|
import Constants from "../../Models/Constants"
|
||||||
|
import OpenBackgroundSelectorButton from "../BigComponents/OpenBackgroundSelectorButton.svelte";
|
||||||
|
|
||||||
interface MoveReason {
|
interface MoveReason {
|
||||||
text: Translation | string
|
text: Translation | string
|
||||||
|
|
@ -132,14 +133,21 @@ export default class MoveWizard extends Toggle {
|
||||||
rasterLayer: state.mapProperties.rasterLayer
|
rasterLayer: state.mapProperties.rasterLayer
|
||||||
}
|
}
|
||||||
const value = new UIEventSource<{ lon: number; lat: number }>(undefined)
|
const value = new UIEventSource<{ lon: number; lat: number }>(undefined)
|
||||||
const locationInput = new SvelteUIElement(LocationInput, {
|
const locationInput =
|
||||||
|
new Combine([
|
||||||
|
|
||||||
|
new SvelteUIElement(LocationInput, {
|
||||||
mapProperties,
|
mapProperties,
|
||||||
value,
|
value,
|
||||||
})
|
}).SetClass("w-full h-full"),
|
||||||
|
new SvelteUIElement(OpenBackgroundSelectorButton, {state}).SetClass("absolute bottom-0 left-0")
|
||||||
|
|
||||||
|
]).SetClass("relative w-full h-full")
|
||||||
|
|
||||||
|
|
||||||
let searchPanel: BaseUIElement = undefined
|
let searchPanel: BaseUIElement = undefined
|
||||||
if (reason.includeSearch) {
|
if (reason.includeSearch) {
|
||||||
searchPanel = new SvelteUIElement(Geosearch, { bounds: mapProperties.bounds })
|
searchPanel = new SvelteUIElement(Geosearch, {bounds: mapProperties.bounds, clearAfterView: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
locationInput.SetStyle("height: 17.5rem")
|
locationInput.SetStyle("height: 17.5rem")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue