mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
fix: android clicks
This commit is contained in:
parent
082444f2a7
commit
aeee8f74e5
3 changed files with 27 additions and 20 deletions
|
|
@ -29,8 +29,9 @@ const capacitorConfig = {
|
|||
alias: {
|
||||
...alias,
|
||||
wrtc: false,
|
||||
'node-datachannel': false,
|
||||
'bittorrent-tracker/lib/client/http-tracker.js': resolve('../node_modules/bittorrent-tracker/lib/client/http-tracker.js'),
|
||||
'webrtc-polyfill': resolve('../node_modules/webrtc-polyfill/browser.js')
|
||||
'webrtc-polyfill': false // no webrtc on mobile, need the resources
|
||||
}
|
||||
},
|
||||
target: 'node',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { SUPPORTS } from '@/modules/support.js'
|
||||
|
||||
let lastTapElement = null
|
||||
let lastHoverElement = null
|
||||
|
||||
|
|
@ -26,12 +28,14 @@ export function click (node, cb = noop) {
|
|||
node.addEventListener('pointerleave', e => {
|
||||
e.stopPropagation()
|
||||
})
|
||||
node.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
cb(e)
|
||||
}
|
||||
})
|
||||
if (!SUPPORTS.isAndroid) {
|
||||
node.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
cb(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
||||
|
|
@ -57,19 +61,21 @@ export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
|||
lastTapElement = hoverUpdate
|
||||
}
|
||||
})
|
||||
node.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
lastTapElement?.(false)
|
||||
if (lastTapElement === hoverUpdate) {
|
||||
lastTapElement = null
|
||||
cb(e)
|
||||
} else {
|
||||
hoverUpdate(true)
|
||||
lastTapElement = hoverUpdate
|
||||
if (!SUPPORTS.isAndroid) {
|
||||
node.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
lastTapElement?.(false)
|
||||
if (lastTapElement === hoverUpdate) {
|
||||
lastTapElement = null
|
||||
cb(e)
|
||||
} else {
|
||||
hoverUpdate(true)
|
||||
lastTapElement = hoverUpdate
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
node.addEventListener('pointerup', e => {
|
||||
e.stopPropagation()
|
||||
if (e.pointerType === 'mouse') setTimeout(() => hoverUpdate(false))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const announce = [
|
|||
let storedSettings = {}
|
||||
|
||||
// HACK: this is https only, but electron doesnt run in https
|
||||
if (!globalThis.FileSystemFileHandle) global.FileSystemFileHandle = false
|
||||
if (!globalThis.FileSystemFileHandle) globalThis.FileSystemFileHandle = false
|
||||
|
||||
try {
|
||||
storedSettings = JSON.parse(localStorage.getItem('settings')) || {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue