Remove logging and force OL3 to redraw

This commit is contained in:
Lukas Martinelli
2016-12-22 21:06:32 +01:00
parent 5d68867840
commit 42fd5dcfa7
7 changed files with 21 additions and 25 deletions
+9 -3
View File
@@ -13,7 +13,14 @@ class OpenLayers3Map extends Map {
const olms = require('ol-mapbox-style')
const jsonStyle = nextProps.mapStyle
const styleFunc = olms.getStyleFunction(jsonStyle, 'openmaptiles', this.resolutions)
this.layer.setStyle(styleFunc)
console.log('New style babee')
const layer = this.layer
layer.setStyle(styleFunc)
//NOTE: We need to mark the source as changed in order
//to trigger a rerender
layer.getSource().changed()
this.state.map.render()
})
}
@@ -43,9 +50,8 @@ class OpenLayers3Map extends Map {
const styleFunc = olms.getStyleFunction(jsonStyle, 'openmaptiles', this.resolutions)
this.layer.setStyle(styleFunc)
console.log(jsonStyle.center, jsonStyle.zoom)
const map = new ol.Map({
target: this.container,
target: this.container,
layers: [this.layer],
view: new ol.View({
center: jsonStyle.center,