mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
Fix reordering of layers (#2316)
Broken in the map split I guess. (Only the first line is the fix, the other are just naming, cf the two commits.)
This commit is contained in:
commit
d9998efc0f
1 changed files with 8 additions and 8 deletions
|
@ -596,7 +596,7 @@ export default class Umap extends ServerStored {
|
|||
const panes = this._leafletMap.getPane('overlayPane')
|
||||
|
||||
this.datalayersIndex = []
|
||||
for (const pane of panes) {
|
||||
for (const pane of panes.children) {
|
||||
if (!pane.dataset || !pane.dataset.id) continue
|
||||
this.datalayersIndex.push(this.datalayers[pane.dataset.id])
|
||||
}
|
||||
|
@ -1425,13 +1425,13 @@ export default class Umap extends ServerStored {
|
|||
row.dataset.id = stamp(datalayer)
|
||||
})
|
||||
const onReorder = (src, dst, initialIndex, finalIndex) => {
|
||||
const layer = this.datalayers[src.dataset.id]
|
||||
const other = this.datalayers[dst.dataset.id]
|
||||
const minIndex = Math.min(layer.getRank(), other.getRank())
|
||||
const maxIndex = Math.max(layer.getRank(), other.getRank())
|
||||
if (finalIndex === 0) layer.bringToTop()
|
||||
else if (finalIndex > initialIndex) layer.insertBefore(other)
|
||||
else layer.insertAfter(other)
|
||||
const movedLayer = this.datalayers[src.dataset.id]
|
||||
const targetLayer = this.datalayers[dst.dataset.id]
|
||||
const minIndex = Math.min(movedLayer.getRank(), targetLayer.getRank())
|
||||
const maxIndex = Math.max(movedLayer.getRank(), targetLayer.getRank())
|
||||
if (finalIndex === 0) movedLayer.bringToTop()
|
||||
else if (finalIndex > initialIndex) movedLayer.insertBefore(targetLayer)
|
||||
else movedLayer.insertAfter(targetLayer)
|
||||
this.eachDataLayerReverse((datalayer) => {
|
||||
if (datalayer.getRank() >= minIndex && datalayer.getRank() <= maxIndex)
|
||||
datalayer.isDirty = true
|
||||
|
|
Loading…
Reference in a new issue