From b9721b80c50a1f2b6f1ad93ca6c670b553ad8a91 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Sat, 24 Aug 2024 21:17:48 +0900 Subject: [PATCH] Add touchstarttimer --- src/ts/hotkey.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ts/hotkey.ts b/src/ts/hotkey.ts index 2ffe0007..8af7e5e7 100644 --- a/src/ts/hotkey.ts +++ b/src/ts/hotkey.ts @@ -101,17 +101,22 @@ export function initHotkey(){ let touchs = 0 + let touchStartTime = 0 //check for triple touch document.addEventListener('touchstart', async (ev) => { touchs++ if(touchs > 2){ + if(Date.now() - touchStartTime > 300){ + return + } touchs = 0 if(doingAlert()){ return } const selStr = await alertSelect([ language.presets, - language.persona + language.persona, + language.cancel ]) const sel = parseInt(selStr) if(sel === 0){ @@ -120,8 +125,9 @@ export function initHotkey(){ if(sel === 1){ openPersonaList.set(!get(openPersonaList)) } - - + } + if(touchs === 1){ + touchStartTime = Date.now() } }) document.addEventListener('touchend', (ev) => {