mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-02-06 17:05:38 +01:00
Switch renderer with inspect mode
This commit is contained in:
parent
f332d517f3
commit
6e9e66b147
1 changed files with 17 additions and 1 deletions
|
@ -99,6 +99,22 @@ export default class Toolbar extends React.Component {
|
||||||
</ToolbarAction>
|
</ToolbarAction>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleInspectionMode() {
|
||||||
|
const metadata = this.props.mapStyle.metadata || {}
|
||||||
|
const currentRenderer = metadata['maputnik:renderer'] || 'mbgljs'
|
||||||
|
|
||||||
|
const changedRenderer = currentRenderer === 'inspection' ? 'mbgljs' : 'inspection'
|
||||||
|
|
||||||
|
const changedStyle = {
|
||||||
|
...this.props.mapStyle,
|
||||||
|
metadata: {
|
||||||
|
'maputnik:renderer': changedRenderer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.onStyleChanged(changedStyle)
|
||||||
|
}
|
||||||
|
|
||||||
toggleModal(modalName) {
|
toggleModal(modalName) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isOpen: {
|
isOpen: {
|
||||||
|
@ -160,7 +176,7 @@ export default class Toolbar extends React.Component {
|
||||||
<MdSettings />
|
<MdSettings />
|
||||||
<IconText>Style Settings</IconText>
|
<IconText>Style Settings</IconText>
|
||||||
</ToolbarAction>
|
</ToolbarAction>
|
||||||
<ToolbarAction onClick={this.toggleModal.bind(this, 'settings')}>
|
<ToolbarAction onClick={this.toggleInspectionMode.bind(this)}>
|
||||||
<MdFindInPage />
|
<MdFindInPage />
|
||||||
<IconText>Inspect</IconText>
|
<IconText>Inspect</IconText>
|
||||||
</ToolbarAction>
|
</ToolbarAction>
|
||||||
|
|
Loading…
Reference in a new issue