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:
@@ -54,6 +54,7 @@
|
||||
container: 'map',
|
||||
hash: true,
|
||||
maplibreLogo: true,
|
||||
maxPitch: 85,
|
||||
style: {
|
||||
version: 8,
|
||||
sources: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user