Usability: give error message if WebGL is disabled
This commit is contained in:
parent
db15e56f94
commit
bfb70c8593
1 changed files with 14 additions and 1 deletions
15
src/index.ts
15
src/index.ts
|
@ -7,9 +7,22 @@ import Combine from "./UI/Base/Combine"
|
||||||
import { SubtleButton } from "./UI/Base/SubtleButton"
|
import { SubtleButton } from "./UI/Base/SubtleButton"
|
||||||
import Svg from "./Svg"
|
import Svg from "./Svg"
|
||||||
import { Utils } from "./Utils"
|
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
|
// @ts-ignore
|
||||||
try {
|
try {
|
||||||
|
if (!webgl_support()) {
|
||||||
|
throw "WebGL is not supported or not enabled. This is essential for MapComplete to function, please enable this."
|
||||||
|
}
|
||||||
DetermineLayout.GetLayout()
|
DetermineLayout.GetLayout()
|
||||||
.then((layout) => {
|
.then((layout) => {
|
||||||
const state = new ThemeViewState(layout)
|
const state = new ThemeViewState(layout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue