Fix rotation reset and add attributions
This commit is contained in:
@@ -39,20 +39,16 @@ const mbLayer = new Layer({
|
|||||||
|
|
||||||
// adjust view parameters in mapbox
|
// adjust view parameters in mapbox
|
||||||
const rotation = viewState.rotation;
|
const rotation = viewState.rotation;
|
||||||
if (rotation) {
|
|
||||||
mbMap.rotateTo((-rotation * 180) / Math.PI, {
|
|
||||||
animate: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
mbMap.jumpTo({
|
mbMap.jumpTo({
|
||||||
center: toLonLat(viewState.center),
|
center: toLonLat(viewState.center),
|
||||||
zoom: viewState.zoom - 1,
|
zoom: viewState.zoom - 1,
|
||||||
|
bearing: (-rotation * 180) / Math.PI,
|
||||||
animate: false,
|
animate: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// cancel the scheduled update & trigger synchronous redraw
|
// cancel the scheduled update & trigger synchronous redraw
|
||||||
// see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
|
// see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
|
||||||
// NOTE: THIS MIGHT BREAK WHEN UPDATING MAPBOX
|
// NOTE: THIS MIGHT BREAK IF UPDATING THE MAPBOX VERSION
|
||||||
if (mbMap._frame) {
|
if (mbMap._frame) {
|
||||||
mbMap._frame.cancel();
|
mbMap._frame.cancel();
|
||||||
mbMap._frame = null;
|
mbMap._frame = null;
|
||||||
@@ -61,6 +57,12 @@ const mbLayer = new Layer({
|
|||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
|
source: new Source({
|
||||||
|
attributions: [
|
||||||
|
'<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a>',
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>',
|
||||||
|
],
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const style = new Style({
|
const style = new Style({
|
||||||
|
|||||||
Reference in New Issue
Block a user