mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
fix mapbox wrapper viewstate support (#521)
This commit is contained in:
parent
b9d8b9e568
commit
42a024c366
@ -23,7 +23,6 @@
|
||||
],
|
||||
"scripts": {
|
||||
"start": "(cd examples/main && (path-exists node_modules || npm i) && npm run start-local)",
|
||||
"clean": "rm -fr dist dist-es6 && mkdir -p dist/es5 dist/esm dist/es6",
|
||||
"build": "./scripts/build.sh && ./scripts/collect-metrics.sh",
|
||||
"publish-prod": "npm run build && npm run test && npm publish",
|
||||
"publish-beta": "npm run build && npm run test && npm publish --tag beta",
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
export PATH=$PATH:node_modules/.bin
|
||||
|
||||
rm -fr dist
|
||||
|
||||
BABEL_ENV=es6 babel src --out-dir dist/es6 --source-maps --ignore 'node_modules/' &&
|
||||
BABEL_ENV=esm babel src --out-dir dist/esm --source-maps --ignore 'node_modules/' &&
|
||||
BABEL_ENV=es5 babel src --out-dir dist/es5 --source-maps --ignore 'node_modules/'
|
||||
@ -171,10 +171,10 @@ export default class Mapbox {
|
||||
} else {
|
||||
const mapOptions = {
|
||||
container: props.container || document.body,
|
||||
center: [props.longitude, props.latitude],
|
||||
zoom: props.zoom,
|
||||
pitch: props.pitch,
|
||||
bearing: props.bearing,
|
||||
center: [0, 0],
|
||||
zoom: 8,
|
||||
pitch: 0,
|
||||
bearing: 0,
|
||||
style: props.mapStyle,
|
||||
interactive: false,
|
||||
attributionControl: props.attributionControl,
|
||||
@ -286,7 +286,15 @@ export default class Mapbox {
|
||||
}
|
||||
|
||||
_getViewState(props) {
|
||||
return props.viewState || props;
|
||||
const {
|
||||
longitude,
|
||||
latitude,
|
||||
zoom,
|
||||
pitch = 0,
|
||||
bearing = 0,
|
||||
altitude = 1.5
|
||||
} = props.viewState || props;
|
||||
return {longitude, latitude, zoom, pitch, bearing, altitude};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user