Some cleanup of changesetHandler, add import source with reference to the note
This commit is contained in:
parent
7f222bce11
commit
5cefc4d25f
4 changed files with 129 additions and 55 deletions
|
@ -117,7 +117,7 @@ export default class FilterView extends VariableUiElement {
|
|||
|
||||
const style =
|
||||
"display:flex;align-items:center;padding:0.5rem 0;";
|
||||
const layerIcon = layer.defaultIcon()?.SetClass("w-8 h-8 ml-2")
|
||||
const layerIcon = layer.defaultIcon()?.SetClass("w-8 h-8 ml-2 shrink-0")
|
||||
const layerIconUnchecked = layer.defaultIcon()?.SetClass("opacity-50 w-8 h-8 ml-2")
|
||||
|
||||
const layerChecked = new Combine([icon, layerIcon, styledNameChecked, zoomStatus])
|
||||
|
|
|
@ -523,26 +523,25 @@ export class ImportPointButton extends AbstractImportButton {
|
|||
snapOnto = await OsmObject.DownloadObjectAsync(snapOntoWayId)
|
||||
}
|
||||
let specialMotivation = undefined
|
||||
if (args.note_id !== undefined) {
|
||||
specialMotivation = "source: https://osm.org/note/" + args.note_id
|
||||
|
||||
let note_id = args.note_id
|
||||
if (args.note_id !== undefined && isNaN(Number(args.note_id))) {
|
||||
note_id = originalFeatureTags.data[args.note_id]
|
||||
specialMotivation = "source: https://osm.org/note/" + note_id
|
||||
}
|
||||
|
||||
const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, {
|
||||
theme: state.layoutToUse.id,
|
||||
changeType: "import",
|
||||
snapOnto: <OsmWay>snapOnto,
|
||||
specialMotivation
|
||||
specialMotivation: specialMotivation
|
||||
})
|
||||
|
||||
await state.changes.applyAction(newElementAction)
|
||||
state.selectedElement.setData(state.allElements.ContainingFeatures.get(
|
||||
newElementAction.newElementId
|
||||
))
|
||||
if (args.note_id !== undefined) {
|
||||
let note_id = args.note_id
|
||||
if (isNaN(Number(args.note_id))) {
|
||||
note_id = originalFeatureTags.data[args.note_id]
|
||||
}
|
||||
|
||||
if (note_id !== undefined) {
|
||||
state.osmConnection.closeNote(note_id, "imported")
|
||||
originalFeatureTags.data["closed_at"] = new Date().toISOString()
|
||||
originalFeatureTags.ping()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue