mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
fix: update star icon on star/unstar
This commit is contained in:
parent
24511d796d
commit
f93d0b5ca7
2 changed files with 7 additions and 6 deletions
|
@ -1346,6 +1346,11 @@ export default class Umap extends ServerStored {
|
||||||
el.textContent = this.sync.getNumberOfConnectedPeers()
|
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)) {
|
for (const [field, impact] of Object.entries(impacts)) {
|
||||||
if (!fields.length || fields.includes(field)) {
|
if (!fields.length || fields.includes(field)) {
|
||||||
|
@ -1531,7 +1536,7 @@ export default class Umap extends ServerStored {
|
||||||
? translate('Map has been starred')
|
? translate('Map has been starred')
|
||||||
: translate('Map has been unstarred')
|
: translate('Map has been unstarred')
|
||||||
)
|
)
|
||||||
this.render(['starred'])
|
this.render(['properties.starred'])
|
||||||
}
|
}
|
||||||
|
|
||||||
processFileToImport(file, layer, type) {
|
processFileToImport(file, layer, type) {
|
||||||
|
|
|
@ -541,11 +541,7 @@ U.StarControl = L.Control.Button.extend({
|
||||||
options: {
|
options: {
|
||||||
position: 'topleft',
|
position: 'topleft',
|
||||||
title: L._('Star this map'),
|
title: L._('Star this map'),
|
||||||
},
|
className: 'leaflet-control-star map-star umap-control',
|
||||||
|
|
||||||
getClassName: function () {
|
|
||||||
const status = this._umap.properties.starred ? ' starred' : ''
|
|
||||||
return `leaflet-control-star umap-control${status}`
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
|
|
Loading…
Reference in a new issue