-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (28 loc) · 844 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const size = {
width: 400,
height: 400,
};
let activeCanvas;
// Fullscreen mode
window.addEventListener("dblclick", (event) => {
activeCanvas = event.target;
if (activeCanvas.classList.contains("glslCanvas")) {
const fullscreenElement =
document.fullscreenElement || document.webkitFullscreenElement;
if (!fullscreenElement) {
if (activeCanvas.requestFullscreen) {
activeCanvas.requestFullscreen();
} else if (activeCanvas.webkitRequestFullscreen) {
activeCanvas.webkitRequestFullscreen();
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
activeCanvas.width = `${size.width}`;
activeCanvas.height = `${size.height}`;
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}
});