AOSSIE-Org / AOSSIE-Org/Rein

[Enhanacement]: Centralize gesture state reset logic in useTrackpadGesture

Đang mở
#281 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
38
Fork
78
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
6

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.