Improved showTileBoundaries and query string support

This commit is contained in:
orangemug 2018-06-03 17:33:08 +01:00
parent 0516e587b4
commit 6cdb56d13f
2 changed files with 4 additions and 4 deletions

View file

@ -31,6 +31,7 @@ import LayerWatcher from '../libs/layerwatcher'
import tokens from '../config/tokens.json' import tokens from '../config/tokens.json'
import isEqual from 'lodash.isequal' import isEqual from 'lodash.isequal'
import Debug from '../libs/debug' import Debug from '../libs/debug'
import queryUtil from '../libs/query-util'
import MapboxGl from 'mapbox-gl' import MapboxGl from 'mapbox-gl'
import mapboxUtil from 'mapbox-gl/src/util/mapbox' import mapboxUtil from 'mapbox-gl/src/util/mapbox'
@ -173,7 +174,7 @@ export default class App extends React.Component {
export: false, export: false,
}, },
mapOptions: { mapOptions: {
showTileBoundaries: !!queryObj.showTileBoundaries showTileBoundaries: queryUtil.asBool(queryObj, "show-tile-boundaries")
}, },
mapFilter: queryObj["color-blindness-emulation"], mapFilter: queryObj["color-blindness-emulation"],
} }

View file

@ -99,6 +99,7 @@ export default class MapboxGlMap extends React.Component {
if(this.props.inspectModeEnabled) { if(this.props.inspectModeEnabled) {
this.state.inspect.render() this.state.inspect.render()
} }
this.state.map.showTileBoundaries = this.props.options.showTileBoundaries;
} }
componentDidMount() { componentDidMount() {
@ -111,9 +112,7 @@ export default class MapboxGlMap extends React.Component {
const map = new MapboxGl.Map(mapOpts); const map = new MapboxGl.Map(mapOpts);
if(mapOpts.showTileBoundaries) { map.showTileBoundaries = mapOpts.showTileBoundaries;
map.showTileBoundaries = mapOpts.showTileBoundaries;
}
const zoom = new ZoomControl; const zoom = new ZoomControl;
map.addControl(zoom, 'top-right'); map.addControl(zoom, 'top-right');