From 6cdb56d13fcf3c0867448bb58f5f409e0cc1e40a Mon Sep 17 00:00:00 2001 From: orangemug Date: Sun, 3 Jun 2018 17:33:08 +0100 Subject: [PATCH] Improved showTileBoundaries and query string support --- src/components/App.jsx | 3 ++- src/components/map/MapboxGlMap.jsx | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index 3289707..4d724f7 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -31,6 +31,7 @@ import LayerWatcher from '../libs/layerwatcher' import tokens from '../config/tokens.json' import isEqual from 'lodash.isequal' import Debug from '../libs/debug' +import queryUtil from '../libs/query-util' import MapboxGl from 'mapbox-gl' import mapboxUtil from 'mapbox-gl/src/util/mapbox' @@ -173,7 +174,7 @@ export default class App extends React.Component { export: false, }, mapOptions: { - showTileBoundaries: !!queryObj.showTileBoundaries + showTileBoundaries: queryUtil.asBool(queryObj, "show-tile-boundaries") }, mapFilter: queryObj["color-blindness-emulation"], } diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 792c017..85faf47 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -99,6 +99,7 @@ export default class MapboxGlMap extends React.Component { if(this.props.inspectModeEnabled) { this.state.inspect.render() } + this.state.map.showTileBoundaries = this.props.options.showTileBoundaries; } componentDidMount() { @@ -111,9 +112,7 @@ export default class MapboxGlMap extends React.Component { const map = new MapboxGl.Map(mapOpts); - if(mapOpts.showTileBoundaries) { - map.showTileBoundaries = mapOpts.showTileBoundaries; - } + map.showTileBoundaries = mapOpts.showTileBoundaries; const zoom = new ZoomControl; map.addControl(zoom, 'top-right');