Allow renderer switching via style metadata

This commit is contained in:
Lukas Martinelli
2016-12-16 17:13:05 +01:00
parent b46598c33f
commit f1a21eca0c
2 changed files with 21 additions and 2 deletions

View File

@@ -100,6 +100,7 @@ export default class App extends React.Component {
}
render() {
const renderer = this.state.currentStyle.getIn(['metadata', 'maputnik:renderer'], 'mbgljs')
const mapProps = {
mapStyle: this.state.currentStyle,
accessToken: this.state.accessToken,
@@ -120,8 +121,8 @@ export default class App extends React.Component {
accessToken={this.state.accessToken}
onAccessTokenChanged={this.onAccessTokenChanged.bind(this)}
/>
{this.state.mapRenderer == 'ol3' && <OpenLayers3Map {...mapProps} />}
{this.state.mapRenderer == 'gl' && <MapboxGlMap {...mapProps} />}
{renderer == 'ol3' && <OpenLayers3Map {...mapProps} />}
{renderer == 'mbgljs' && <MapboxGlMap {...mapProps} />}
</div>
}
}