mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 08:42:31 +00:00
manual webgl2 check
This commit is contained in:
@@ -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">
|
||||||
|
Reference in New Issue
Block a user