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;
|
||||
|
||||
let webgl2Supported = true;
|
||||
let fitBoundsOptions: mapboxgl.FitBoundsOptions = {
|
||||
maxZoom: 15,
|
||||
linear: true,
|
||||
|
@ -34,7 +35,9 @@
|
|||
});
|
||||
|
||||
onMount(() => {
|
||||
if (!mapboxgl.supported()) {
|
||||
let gl = document.createElement('canvas').getContext('webgl2');
|
||||
if (!gl) {
|
||||
webgl2Supported = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,7 +148,7 @@
|
|||
</script>
|
||||
|
||||
<div {...$$restProps}>
|
||||
{#if mapboxgl.supported()}
|
||||
{#if webgl2Supported}
|
||||
<div id="map" class="h-full"></div>
|
||||
{:else}
|
||||
<div class="flex flex-col items-center justify-center gap-3 h-full">
|
||||
|
|
Loading…
Reference in a new issue