Skip to content

Commit

Permalink
Check possibility updating tags
Browse files Browse the repository at this point in the history
  • Loading branch information
zlant committed Feb 24, 2023
1 parent e11ea17 commit caa885e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parking/controls/editor/editor-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function getLaneEditForm(osm: OsmWay, waysInRelation: WaysInRelation, cut
<button title="Update tags"
type="button"
class="editor-form__cut-button"
style="${canUpdateTags(osm) ? null : displayNone }"
onclick=${() => handleOpenTagsUpdatingModalClick(osm)}>
🔄
</button>
Expand Down Expand Up @@ -436,6 +437,11 @@ function handlePresetClick(
element.dispatchEvent(new Event('change'))
}

function canUpdateTags(way: OsmWay) {
const updateInfo = transpose(Object.entries(way.tags).map(x=>`${x[0]}=${x[1]}`))
return Object.keys(updateInfo.newTagObjects).length > 0
}

function handleOpenTagsUpdatingModalClick(way: OsmWay) {
const updateInfo = transpose(Object.entries(way.tags).map(x=>`${x[0]}=${x[1]}`))

Expand Down

0 comments on commit caa885e

Please sign in to comment.