Skip to content

Commit

Permalink
fix: update star icon on star/unstar
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanboniface committed Dec 19, 2024
1 parent 24511d7 commit f93d0b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 6 additions & 1 deletion umap/static/umap/js/modules/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,11 @@ export default class Umap extends ServerStored {
el.textContent = this.sync.getNumberOfConnectedPeers()
})
},
'properties.starred': () => {
Utils.eachElement('.map-star', (el) => {
el.classList.toggle('starred', this.properties.starred)
})
},
}
for (const [field, impact] of Object.entries(impacts)) {
if (!fields.length || fields.includes(field)) {
Expand Down Expand Up @@ -1531,7 +1536,7 @@ export default class Umap extends ServerStored {
? translate('Map has been starred')
: translate('Map has been unstarred')
)
this.render(['starred'])
this.render(['properties.starred'])
}

processFileToImport(file, layer, type) {
Expand Down
6 changes: 1 addition & 5 deletions umap/static/umap/js/umap.controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,7 @@ U.StarControl = L.Control.Button.extend({
options: {
position: 'topleft',
title: L._('Star this map'),
},

getClassName: function () {
const status = this._umap.properties.starred ? ' starred' : ''
return `leaflet-control-star umap-control${status}`
className: 'leaflet-control-star map-star umap-control',
},

onClick: function () {
Expand Down

0 comments on commit f93d0b5

Please sign in to comment.