diff --git a/examples/mapbox-layer.css b/examples/mapbox-layer.css
new file mode 100644
index 0000000000..07c3d5d8d2
--- /dev/null
+++ b/examples/mapbox-layer.css
@@ -0,0 +1,5 @@
+/* Reset font size changed by Mapbox CSS */
+.map {
+ font-size: medium;
+ font-family: 'Quattrocento Sans', sans-serif;
+}
diff --git a/examples/mapbox-layer.html b/examples/mapbox-layer.html
index 05a67fdf21..bd8bfa7ec6 100644
--- a/examples/mapbox-layer.html
+++ b/examples/mapbox-layer.html
@@ -7,8 +7,8 @@ docs: >
tags: "simple, mapbox, vector, tiles, maptiler"
experimental: true
resources:
- - https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.js
- - https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.css
+ - https://unpkg.com/mapbox-gl@1.11.1/dist/mapbox-gl.js
+ - https://unpkg.com/mapbox-gl@1.11.1/dist/mapbox-gl.css
cloak:
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
value: Get your own API key at https://www.maptiler.com/cloud/
diff --git a/examples/mapbox-layer.js b/examples/mapbox-layer.js
index 5da67e8fb8..e2f93463d5 100644
--- a/examples/mapbox-layer.js
+++ b/examples/mapbox-layer.js
@@ -1,6 +1,7 @@
import GeoJSON from '../src/ol/format/GeoJSON.js';
import Layer from '../src/ol/layer/Layer.js';
import Map from '../src/ol/Map.js';
+import Source from '../src/ol/source/Source.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import View from '../src/ol/View.js';
@@ -39,20 +40,16 @@ const mbLayer = new Layer({
// adjust view parameters in mapbox
const rotation = viewState.rotation;
- if (rotation) {
- mbMap.rotateTo((-rotation * 180) / Math.PI, {
- animate: false,
- });
- }
mbMap.jumpTo({
center: toLonLat(viewState.center),
zoom: viewState.zoom - 1,
+ bearing: (-rotation * 180) / Math.PI,
animate: false,
});
// cancel the scheduled update & trigger synchronous redraw
// 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) {
mbMap._frame.cancel();
mbMap._frame = null;
@@ -61,6 +58,12 @@ const mbLayer = new Layer({
return canvas;
},
+ source: new Source({
+ attributions: [
+ '© MapTiler',
+ '© OpenStreetMap contributors',
+ ],
+ }),
});
const style = new Style({