From fc3f3e34d88e838490fe7e666c63de1d88928f38 Mon Sep 17 00:00:00 2001 From: da-in Date: Sat, 6 Apr 2024 19:17:32 +0900 Subject: [PATCH] hotfix timer bug --- src/hooks/use-player.ts | 2 +- src/hooks/use-timer.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/use-player.ts b/src/hooks/use-player.ts index 2c6ac89..7e38790 100644 --- a/src/hooks/use-player.ts +++ b/src/hooks/use-player.ts @@ -145,7 +145,7 @@ export const usePlayer = ( } const addBlock = () => { - // currentBlockRef.value = createBlock(4, widthRef.value / 2, 60, ratioRef.value, true) + // currentBlock = createBlock(9, width / 2, 60, ratio, true) currentBlock = createBlock(nextBlockRef.value, width / 2, 60, ratio, true) isSetBlock = false World.add(engine.world, currentBlock) diff --git a/src/hooks/use-timer.ts b/src/hooks/use-timer.ts index 1c1acc3..bae0b8d 100644 --- a/src/hooks/use-timer.ts +++ b/src/hooks/use-timer.ts @@ -1,4 +1,4 @@ -import {ref} from 'vue' +import { ref } from 'vue' export const useTimer = (limit: number, callback: () => void) => { const count = ref(undefined) @@ -12,10 +12,10 @@ export const useTimer = (limit: number, callback: () => void) => { } const start = () => { - count.value = limit if (interval) { return } + count.value = limit interval = setInterval(() => { if (count.value) { count.value = count.value - 1 @@ -32,5 +32,5 @@ export const useTimer = (limit: number, callback: () => void) => { clear() } - return {count, reset, start} + return { count, reset, start } }