Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/extensions/core/simpleTouchSupport.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LGraphCanvas, LiteGraph } from '@/lib/litegraph/src/litegraph'

import { app } from '../../scripts/app'
import { app } from '@/scripts/app'

let touchZooming = false
let touchCount = 0
Expand Down Expand Up @@ -82,6 +82,26 @@ app.registerExtension({
}
)

const resetTouchState = () => {
touchCount = 0
touchZooming = false
touchTime = null
lastTouch = null
lastScale = null
touchDist = null
}

// Reset touch state when page loses visibility (e.g., switching apps on iPad)
// This prevents touchCount from getting stuck when touchend events are missed
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
resetTouchState()
}
})

// Also handle touchcancel which fires when touch is interrupted
app.canvasEl.parentElement?.addEventListener('touchcancel', resetTouchState)

app.canvasEl.parentElement?.addEventListener(
'touchmove',
(e) => {
Expand Down