Add friendly confirm message on newly created points

This commit is contained in:
Pieter Vander Vennet 2022-11-07 23:12:31 +01:00
parent 5c28ce2995
commit ccf3bb3993
6 changed files with 63 additions and 30 deletions

View file

@ -27,6 +27,7 @@ import Loading from "../Base/Loading"
import Hash from "../../Logic/Web/Hash"
import { GlobalFilter } from "../../Logic/State/MapState"
import { WayId } from "../../Models/OsmFeature"
import {Tag} from "../../Logic/Tags/Tag";
/*
* The SimpleAddUI is a single panel, which can have multiple states:
@ -97,10 +98,11 @@ export default class SimpleAddUI extends Toggle {
const presetsOverview = SimpleAddUI.CreateAllPresetsPanel(selectedPreset, state)
async function createNewPoint(
tags: any[],
tags: Tag[],
location: { lat: number; lon: number },
snapOntoWay?: OsmWay
): Promise<void> {
tags.push(Tag.newlyCreated)
const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, {
theme: state.layoutToUse?.id ?? "unkown",
changeType: "create",
@ -109,9 +111,8 @@ export default class SimpleAddUI extends Toggle {
await state.changes.applyAction(newElementAction)
selectedPreset.setData(undefined)
isShown.setData(false)
state.selectedElement.setData(
state.allElements.ContainingFeatures.get(newElementAction.newElementId)
)
const selectedFeature = state.allElements.ContainingFeatures.get(newElementAction.newElementId)
state.selectedElement.setData(selectedFeature)
Hash.hash.setData(newElementAction.newElementId)
}