Improve Drag Gesture Quality (Plan 021)
mainThis plan addresses three specific quality-of-life issues in the drag engine to improve performance and user experience:
- Inertia Hard-Stop: Replacing the current 'overdamp hack' (using extremely high stiffness and damping values to simulate
dragElastic: false) with a nativebounce: falseoption in the inertia generator. This is more efficient and avoids numeric extremes in spring evaluation. - Resize Throttling: Preventing layout thrashing caused by unthrottled synchronous
scalePositionWithinConstraintscalls during window resize events. The goal is to ensure resize measurements and re-renders are throttled within a single frame. - Direction-Lock Fairness: Fixing the current Y-axis bias in
getCurrentDirection. Currently, the engine checks the Y-axis threshold before the X-axis, which can cause fast diagonal movements to lock to the Y-axis incorrectly. The fix involves comparing magnitudes to lock to the dominant axis.
Note: These improvements are part of the motion-dom package and affect the drag engine used by both React and vanilla JS implementations.