add controls for presenter

This commit is contained in:
Daniel Bulant 2024-03-03 18:34:46 +01:00
parent 8addbcc8b2
commit 6544cd40ea

View file

@ -9,3 +9,25 @@ import script from './scenes/script?scene';
export default makeProject({
scenes: [intro, program, code, printf, script],
});
window.addEventListener("keydown", (e) => {
if (e.key === "PageDown") {
// send fake space key
const event = new KeyboardEvent("keydown", {
key: " ",
code: "Space",
keyCode: 32,
which: 32
});
document.dispatchEvent(event);
} else if (e.key === "PageUp") {
// send fake arrow left key
const event = new KeyboardEvent("keydown", {
key: "ArrowLeft",
code: "ArrowLeft",
keyCode: 37,
which: 37
});
document.dispatchEvent(event);
}
})