mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-11-10 06:07:45 +01:00
Delete works again
This commit is contained in:
parent
0693dc3d42
commit
8566e9f424
1 changed files with 6 additions and 6 deletions
|
@ -17,18 +17,18 @@ export class LayerList extends React.Component {
|
||||||
|
|
||||||
onLayerDestroyed(deletedLayer) {
|
onLayerDestroyed(deletedLayer) {
|
||||||
//TODO: That's just horrible...
|
//TODO: That's just horrible...
|
||||||
|
// Can we use a immutable ordered map to look up and guarantee order
|
||||||
|
// at the same time?
|
||||||
let deleteIdx = -1
|
let deleteIdx = -1
|
||||||
|
for (let entry of this.props.layers.entries()) {
|
||||||
for (let i = 0; i < this.props.layers.length; i++) {
|
let [i, layer] = entry
|
||||||
if(this.props.layers[i].id == deletedLayer.id) {
|
if(layer.get('id') == deletedLayer.get('id')) {
|
||||||
deleteIdx = i
|
deleteIdx = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const remainingLayers = this.props.layers.slice(0)
|
this.props.onLayersChanged(this.props.layers.delete(deleteIdx))
|
||||||
remainingLayers.splice(deleteIdx, 0)
|
|
||||||
this.props.onLayersChanged(remainingLayers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onLayerChanged(changedLayer) {
|
onLayerChanged(changedLayer) {
|
||||||
|
|
Loading…
Reference in a new issue