AOSSIE-Org / AOSSIE-Org/Rein

[Enhanacement]: Centralize gesture state reset logic in useTrackpadGesture

Offen
#281 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
38
Forks
78
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
6

Beschreibung

Currently, the gesture state inside useTrackpadGesture is reset in multiple places across the hook. This makes the logic harder to maintain and increases the risk of missing a state variable when new gesture states are introduced.

A helper function can be introduced to centralize the reset logic for all gesture-related refs.

```Javascript
const resetGestureState = () => {
ongoingTouches.current.clear()
moved.current = false
releasedCount.current = 0
dragging.current = false
lastPinchDist.current = null
pinching.current = false

if (draggingTimeout.current) {
clearTimeout(draggingTimeout.current)
draggingTimeout.current = null
}
}
```

Cleaner gesture lifecycle management and easier future extensions to the gesture system.

Please assign this to me !!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.