mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
Added option to display tile boundries (issue #202)
This commit is contained in:
@@ -172,6 +172,9 @@ export default class App extends React.Component {
|
|||||||
shortcuts: false,
|
shortcuts: false,
|
||||||
export: false,
|
export: false,
|
||||||
},
|
},
|
||||||
|
mapOptions: {
|
||||||
|
showTileBoundaries: !!queryObj.showTileBoundaries
|
||||||
|
},
|
||||||
mapFilter: queryObj["color-blindness-emulation"],
|
mapFilter: queryObj["color-blindness-emulation"],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +405,7 @@ export default class App extends React.Component {
|
|||||||
mapRenderer() {
|
mapRenderer() {
|
||||||
const mapProps = {
|
const mapProps = {
|
||||||
mapStyle: style.replaceAccessToken(this.state.mapStyle, {allowFallback: true}),
|
mapStyle: style.replaceAccessToken(this.state.mapStyle, {allowFallback: true}),
|
||||||
|
options: this.state.mapOptions,
|
||||||
onDataChange: (e) => {
|
onDataChange: (e) => {
|
||||||
this.layerWatcher.analyzeMap(e.map)
|
this.layerWatcher.analyzeMap(e.map)
|
||||||
this.fetchSources();
|
this.fetchSources();
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default class MapboxGlMap extends React.Component {
|
|||||||
mapStyle: PropTypes.object.isRequired,
|
mapStyle: PropTypes.object.isRequired,
|
||||||
inspectModeEnabled: PropTypes.bool.isRequired,
|
inspectModeEnabled: PropTypes.bool.isRequired,
|
||||||
highlightedLayer: PropTypes.object,
|
highlightedLayer: PropTypes.object,
|
||||||
|
options: PropTypes.object,
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@@ -101,11 +102,18 @@ export default class MapboxGlMap extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const map = new MapboxGl.Map({
|
const mapOpts = {
|
||||||
|
...this.props.options,
|
||||||
container: this.container,
|
container: this.container,
|
||||||
style: this.props.mapStyle,
|
style: this.props.mapStyle,
|
||||||
hash: true,
|
hash: true,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
const map = new MapboxGl.Map(mapOpts);
|
||||||
|
|
||||||
|
if(mapOpts.showTileBoundaries) {
|
||||||
|
map.showTileBoundaries = mapOpts.showTileBoundaries;
|
||||||
|
}
|
||||||
|
|
||||||
const zoom = new ZoomControl;
|
const zoom = new ZoomControl;
|
||||||
map.addControl(zoom, 'top-right');
|
map.addControl(zoom, 'top-right');
|
||||||
|
|||||||
Reference in New Issue
Block a user