Skip to content

Commit

Permalink
No right click on Q3
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinBrett committed Jan 19, 2025
1 parent 605ae73 commit a5c75ba
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions components/apps/Quake3/useQuake3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type EmscriptenFS } from "contexts/fileSystem/useAsyncFs";
import { useProcesses } from "contexts/process";
import { useSession } from "contexts/session";
import { PREVENT_SCROLL, TRANSITIONS_IN_MILLISECONDS } from "utils/constants";
import { loadFiles, pxToNum } from "utils/functions";
import { haltEvent, loadFiles, pxToNum } from "utils/functions";
import useIsolatedContentWindow from "hooks/useIsolatedContentWindow";

declare global {
Expand Down Expand Up @@ -87,8 +87,22 @@ const useQuake3 = ({
newContentWindow.ioq3.callMain([]);

setLoading(false);
mountEmFs(newContentWindow.FS as EmscriptenFS, "Quake3");
setContentWindow(newContentWindow);

const initCanvas = (): void => {
if (newContentWindow.ioq3?.canvas) {
newContentWindow.ioq3.canvas.addEventListener(
"contextmenu",
haltEvent
);

mountEmFs(newContentWindow.FS as EmscriptenFS, "Quake3");
setContentWindow(newContentWindow);
} else {
requestAnimationFrame(initCanvas);
}
};

initCanvas();
}
);
}
Expand Down

0 comments on commit a5c75ba

Please sign in to comment.