Skip to content

Commit

Permalink
Merge pull request #1497 from jschleic/fix-rank-on-reordering
Browse files Browse the repository at this point in the history
fix dirty flags when re-ordering layers
  • Loading branch information
yohanboniface authored Dec 31, 2023
2 parents 1d32e52 + 70e5dbe commit ced7f3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions umap/static/umap/js/umap.controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,14 @@ L.U.DataLayersControl = L.Control.extend({
function (e) {
const layer = this.map.datalayers[e.src.dataset.id],
other = this.map.datalayers[e.dst.dataset.id],
minIndex = Math.min(e.initialIndex, e.finalIndex)
minIndex = Math.min(layer.getRank(), other.getRank()),
maxIndex = Math.max(layer.getRank(), other.getRank())
if (e.finalIndex === 0) layer.bringToTop()
else if (e.finalIndex > e.initialIndex) layer.insertBefore(other)
else layer.insertAfter(other)
this.map.eachDataLayerReverse((datalayer) => {
if (datalayer.getRank() >= minIndex) datalayer.isDirty = true
if (datalayer.getRank() >= minIndex && datalayer.getRank() <= maxIndex)
datalayer.isDirty = true
})
this.map.indexDatalayers()
},
Expand Down

0 comments on commit ced7f3d

Please sign in to comment.