mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-27 03:38:38 +01:00
Fix bug with layer updates
This commit is contained in:
parent
cb590d7e26
commit
97b665485e
1 changed files with 5 additions and 8 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue