manual webgl2 check
This commit is contained in:
parent
d960ec4e72
commit
78d5a478e5
1 changed files with 5 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
mapboxgl.accessToken = accessToken;
|
mapboxgl.accessToken = accessToken;
|
||||||
|
|
||||||
|
let webgl2Supported = true;
|
||||||
let fitBoundsOptions: mapboxgl.FitBoundsOptions = {
|
let fitBoundsOptions: mapboxgl.FitBoundsOptions = {
|
||||||
maxZoom: 15,
|
maxZoom: 15,
|
||||||
linear: true,
|
linear: true,
|
||||||
|
@ -34,7 +35,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (!mapboxgl.supported()) {
|
let gl = document.createElement('canvas').getContext('webgl2');
|
||||||
|
if (!gl) {
|
||||||
|
webgl2Supported = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +148,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...$$restProps}>
|
<div {...$$restProps}>
|
||||||
{#if mapboxgl.supported()}
|
{#if webgl2Supported}
|
||||||
<div id="map" class="h-full"></div>
|
<div id="map" class="h-full"></div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex flex-col items-center justify-center gap-3 h-full">
|
<div class="flex flex-col items-center justify-center gap-3 h-full">
|
||||||
|
|
Loading…
Reference in a new issue