Skip to content

Commit

Permalink
Fix show OSM object on map when open popup #514
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Jun 24, 2024
1 parent 97b66d8 commit d930259
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web/src/pages/map/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
:main_website="main_website"
:remote_url_read="remote_url_read"
@update-issue-uuid="issueUuid = $event"
@q="$refs.osmObject.select($event)"
@elems="$event ? $refs.osmObject.select($event) : $refs.osmObject.clear()"
@remove-marker="
$refs.markerLayer.remove($event)
closed_marker_count += 1
Expand Down
8 changes: 4 additions & 4 deletions web/src/pages/map/osm-object.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export default Vue.extend({
},
methods: {
async select(data) {
data.elems_id = data.elems.map((elem) => elem.type + elem.id).join(',')
async select(elems) {
const elems_id = elems.map((elem) => elem.type + elem.id).join(',')
// Get the OSM objects
if (data.elems_id) {
if (elems_id) {
this.clear()
const features = await Promise.all(
data.elems.map((elem) =>
elems.map((elem) =>
fetch(
elem.type === 'node'
? `${this.remoteUrlRead}api/0.6/node/${elem.id}`
Expand Down
6 changes: 6 additions & 0 deletions web/src/pages/map/popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ export default Vue.extend({
}
},
watch: {
elems() {
this.$emit('elems', this.elems)
},
},
computed: {
api_url(): string {
return (API_URL.startsWith('http') ? '' : location.protocol) + API_URL
Expand Down

0 comments on commit d930259

Please sign in to comment.