mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-29 22:54:39 +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>
|
||||
}
|
||||
|
||||
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) {
|
||||
this.setState({
|
||||
isOpen: {
|
||||
|
@ -160,7 +176,7 @@ export default class Toolbar extends React.Component {
|
|||
<MdSettings />
|
||||
<IconText>Style Settings</IconText>
|
||||
</ToolbarAction>
|
||||
<ToolbarAction onClick={this.toggleModal.bind(this, 'settings')}>
|
||||
<ToolbarAction onClick={this.toggleInspectionMode.bind(this)}>
|
||||
<MdFindInPage />
|
||||
<IconText>Inspect</IconText>
|
||||
</ToolbarAction>
|
||||
|
|
Loading…
Reference in a new issue