mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 14:37:27 +00:00
Switch renderer with inspect mode
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user