Usability: give error message if WebGL is disabled

This commit is contained in:
Pieter Vander Vennet 2023-09-16 02:55:13 +02:00
parent bd71645c04
commit acc5e196e9

View file

@ -7,9 +7,22 @@ import Combine from "./UI/Base/Combine"
import { SubtleButton } from "./UI/Base/SubtleButton"
import Svg from "./Svg"
import { Utils } from "./Utils"
function webgl_support() {
try {
var canvas = document.createElement("canvas")
return (
!!window.WebGLRenderingContext &&
(canvas.getContext("webgl") || canvas.getContext("experimental-webgl"))
)
} catch (e) {
return false
}
}
// @ts-ignore
try {
if (!webgl_support()) {
throw "WebGL is not supported or not enabled. This is essential for MapComplete to function, please enable this."
}
DetermineLayout.GetLayout()
.then((layout) => {
const state = new ThemeViewState(layout)