Update maplibre-gl-js to 3.3.0 / increase default max pitch (#953)

* Update maplibre-gl-js to 3.3.0

* raise maxPitch to 85

* replace maplibregl.supported, that's removed in v3

Use the new example code from https://maplibre.org/maplibre-gl-js/docs/examples/check-for-support/

* remove unneeded note
This commit is contained in:
Andrew Calcutt 2023-08-12 17:57:51 -04:00 committed by GitHub
parent b0af3aee27
commit 9129a62245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -54,6 +54,7 @@
container: 'map',
hash: true,
maplibreLogo: true,
maxPitch: 85,
style: {
version: 8,
sources: {

View File

@ -33,11 +33,27 @@
<h1 style="display:none;">{{name}}</h1>
<div id='map'></div>
<script>
function isWebglSupported() {
if (window.WebGLRenderingContext) {
const canvas = document.createElement('canvas');
try {
const context = canvas.getContext('webgl2') || canvas.getContext('webgl');
if (context && typeof context.getParameter == 'function') {
return true;
}
} catch (e) {
// WebGL is supported, but disabled
}
return false;
}
// WebGL not supported
return false;
}
var q = (location.search || '').substr(1).split('&');
var preference =
q.indexOf('vector') >= 0 ? 'vector' :
(q.indexOf('raster') >= 0 ? 'raster' :
(maplibregl.supported() ? 'vector' : 'raster'));
(isWebglSupported() ? 'vector' : 'raster'));
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
@ -48,7 +64,8 @@
container: 'map',
style: '{{public_url}}styles/{{id}}/style.json' + keyParam,
hash: true,
maplibreLogo: true
maplibreLogo: true,
maxPitch: 85
});
map.addControl(new maplibregl.NavigationControl({
visualizePitch: true,