AOSSIE-Org / AOSSIE-Org/Rein

[Enhanacement]: Centralize gesture state reset logic in useTrackpadGesture

Open
#281 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
38
Forks
78
Avg merge
2d 3h
Merged PRs (30d)
6

Description

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 !!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.