grab cursor

This commit is contained in:
Adrien MALINGREY 2023-06-14 01:22:47 +02:00
parent 2ba22ee7da
commit af24f0a6ef
2 changed files with 174 additions and 174 deletions

12
app.js
View File

@ -769,6 +769,9 @@ controls.maxAzimuthAngle = 2.14 - Math.PI/2
controls.target = P(5, 10) controls.target = P(5, 10)
controls.update() controls.update()
controls.addEventListener("start", () => renderer.domElement.style.cursor = "grabbing")
controls.addEventListener("end", () => renderer.domElement.style.cursor = "grab")
const showFPS = window.location.search.includes("fps") const showFPS = window.location.search.includes("fps")
const fps = new FPS.default(); const fps = new FPS.default();
if (showFPS) document.body.appendChild(fps.dom); if (showFPS) document.body.appendChild(fps.dom);
@ -941,7 +944,6 @@ function pauseSettings() {
music.pause() music.pause()
document.onkeydown = null document.onkeydown = null
renderer.domElement.style.cursor = "auto"
settings.show() settings.show()
} }
@ -977,6 +979,7 @@ function resume(event) {
if (settings.form.checkValidity()) { if (settings.form.checkValidity()) {
settings.modal.hide() settings.modal.hide()
settings.getInputs() settings.getInputs()
renderer.domElement.focus()
document.onkeydown = onkeydown document.onkeydown = onkeydown
document.onkeyup = onkeyup document.onkeyup = onkeyup
@ -990,8 +993,6 @@ function resume(event) {
music.play() music.play()
} }
renderer.domElement.style.cursor = "move"
if (piece) scheduler.setInterval(fall, stats.fallPeriod) if (piece) scheduler.setInterval(fall, stats.fallPeriod)
else generate() else generate()
} }
@ -1145,7 +1146,6 @@ function gameOver() {
document.onkeydown = null document.onkeydown = null
onblur = null onblur = null
playing = false playing = false
renderer.domElement.style.cursor = "auto"
music.pause() music.pause()
stats.show() stats.show()
@ -1156,7 +1156,3 @@ window.onbeforeunload = function(event) {
settings.save() settings.save()
if (playing) return false if (playing) return false
} }
/*if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
}*/

View File

@ -10,6 +10,10 @@ body {
} }
} }
canvas {
cursor: grab;
}
#titleHeader { #titleHeader {
letter-spacing: 1rem; letter-spacing: 1rem;
} }