Add touchstarttimer
This commit is contained in:
@@ -101,17 +101,22 @@ export function initHotkey(){
|
|||||||
|
|
||||||
|
|
||||||
let touchs = 0
|
let touchs = 0
|
||||||
|
let touchStartTime = 0
|
||||||
//check for triple touch
|
//check for triple touch
|
||||||
document.addEventListener('touchstart', async (ev) => {
|
document.addEventListener('touchstart', async (ev) => {
|
||||||
touchs++
|
touchs++
|
||||||
if(touchs > 2){
|
if(touchs > 2){
|
||||||
|
if(Date.now() - touchStartTime > 300){
|
||||||
|
return
|
||||||
|
}
|
||||||
touchs = 0
|
touchs = 0
|
||||||
if(doingAlert()){
|
if(doingAlert()){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const selStr = await alertSelect([
|
const selStr = await alertSelect([
|
||||||
language.presets,
|
language.presets,
|
||||||
language.persona
|
language.persona,
|
||||||
|
language.cancel
|
||||||
])
|
])
|
||||||
const sel = parseInt(selStr)
|
const sel = parseInt(selStr)
|
||||||
if(sel === 0){
|
if(sel === 0){
|
||||||
@@ -120,8 +125,9 @@ export function initHotkey(){
|
|||||||
if(sel === 1){
|
if(sel === 1){
|
||||||
openPersonaList.set(!get(openPersonaList))
|
openPersonaList.set(!get(openPersonaList))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(touchs === 1){
|
||||||
|
touchStartTime = Date.now()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
document.addEventListener('touchend', (ev) => {
|
document.addEventListener('touchend', (ev) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user