mirror of
https://github.com/maputnik/editor.git
synced 2025-12-24 23:20:00 +00:00
Merge remote-tracking branch 'upstream/master' into fix/showTileBoundaries-error
This commit is contained in:
@@ -83,17 +83,17 @@ export default class MapboxGlMap extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
updateMapFromProps(props) {
|
||||
if(!IS_SUPPORTED) return;
|
||||
|
||||
if(!this.state.map) return
|
||||
const metadata = nextProps.mapStyle.metadata || {}
|
||||
const metadata = props.mapStyle.metadata || {}
|
||||
MapboxGl.accessToken = metadata['maputnik:mapbox_access_token'] || tokens.mapbox
|
||||
|
||||
if(!nextProps.inspectModeEnabled) {
|
||||
if(!props.inspectModeEnabled) {
|
||||
//Mapbox GL now does diffing natively so we don't need to calculate
|
||||
//the necessary operations ourselves!
|
||||
this.state.map.setStyle(nextProps.mapStyle, { diff: true})
|
||||
this.state.map.setStyle(props.mapStyle, { diff: true})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ export default class MapboxGlMap extends React.Component {
|
||||
|
||||
const map = this.state.map;
|
||||
|
||||
this.updateMapFromProps(this.props);
|
||||
|
||||
if(this.props.inspectModeEnabled !== prevProps.inspectModeEnabled) {
|
||||
this.state.inspect.toggleInspector()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user