feat(nds): improve fullscreen button and add volume slider
This commit is contained in:
@@ -12,8 +12,9 @@ const createAudio = (path: string) => {
|
||||
return {
|
||||
play: (volume = 1) => {
|
||||
if (!source) return;
|
||||
const app = useAppStore();
|
||||
const audio = source.cloneNode() as HTMLAudioElement;
|
||||
audio.volume = volume;
|
||||
audio.volume = Math.min(1, volume * app.settings.volume);
|
||||
audio.addEventListener("ended", () => audio.remove(), { once: true });
|
||||
audio.play().catch(() => {});
|
||||
},
|
||||
|
||||
@@ -7,6 +7,6 @@ export const useClockTick = () => {
|
||||
const s = now.getSeconds();
|
||||
if (s === lastSecond) return;
|
||||
lastSecond = s;
|
||||
assets.audio.clockTick.play(s === 0 ? 1 : 0.7);
|
||||
assets.audio.clockTick.play(s === 0 ? 2 : 1.4);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -13,6 +13,12 @@ export const useKeyDown = (callback: KeyDownCallback) => {
|
||||
if (app.lagDetected) return;
|
||||
|
||||
const ndsButton = mapCodeToNDS(event.code);
|
||||
if (
|
||||
ndsButton &&
|
||||
document.activeElement &&
|
||||
document.activeElement !== document.body
|
||||
)
|
||||
return;
|
||||
callback({
|
||||
key: ndsButton ? `NDS_${ndsButton}` : event.key,
|
||||
ndsButton,
|
||||
|
||||
Reference in New Issue
Block a user