mirror of
https://github.com/maputnik/editor.git
synced 2025-12-30 10:00:02 +00:00
Fixes lat/lon precision and center change via zoom without pan.
This commit is contained in:
@@ -134,14 +134,12 @@ export default class MapboxGlMap extends React.Component {
|
||||
|
||||
const map = new MapboxGl.Map(mapOpts);
|
||||
|
||||
const center = map.getCenter();
|
||||
const zoom = map.getZoom();
|
||||
|
||||
this.setState({
|
||||
center,
|
||||
zoom,
|
||||
});
|
||||
this.props.onChange({center, zoom});
|
||||
const mapViewChange = () => {
|
||||
const center = map.getCenter();
|
||||
const zoom = map.getZoom();
|
||||
this.props.onChange({center, zoom});
|
||||
}
|
||||
mapViewChange();
|
||||
|
||||
map.showTileBoundaries = mapOpts.showTileBoundaries;
|
||||
map.showCollisionBoxes = mapOpts.showCollisionBoxes;
|
||||
@@ -206,19 +204,8 @@ export default class MapboxGlMap extends React.Component {
|
||||
});
|
||||
});
|
||||
|
||||
map.on("dragend", e => {
|
||||
this.props.onChange({
|
||||
center: map.getCenter(),
|
||||
zoom: this.state.zoom,
|
||||
})
|
||||
});
|
||||
|
||||
map.on("zoomend", e => {
|
||||
this.props.onChange({
|
||||
center: this.state.center,
|
||||
zoom: map.getZoom(),
|
||||
})
|
||||
});
|
||||
map.on("dragend", mapViewChange);
|
||||
map.on("zoomend", mapViewChange);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user