forked from MapComplete/MapComplete
Add friendly confirm message on newly created points
This commit is contained in:
parent
5c28ce2995
commit
ccf3bb3993
6 changed files with 63 additions and 30 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue