Fix bug with layer updates

This commit is contained in:
Lukas Martinelli 2016-12-20 20:50:08 +01:00
parent cb590d7e26
commit 97b665485e

View file

@ -79,14 +79,11 @@ export default class App extends React.Component {
}
onLayerChanged(layer) {
const changedStyle = {
...this.state.mapStyle,
layers: {
...this.state.mapStyle.layers,
[layer.id]: layer
}
}
this.setState({ mapStyle: changedStyle })
const changedLayers = this.state.mapStyle.layers.slice(0)
const idx = style.indexOfLayer(changedLayers, layer.id)
changedLayers[idx] = layer
this.onLayersChange(changedLayers)
}
mapRenderer() {