fix: remove calcDragPosition from default strategies to fix drag position jump (#2223)
The default transformStrategy and absoluteStrategy were returning screen coordinates (clientX - offsetX) in calcDragPosition, but the drag system expects parent-relative coordinates. This caused items to jump down by the distance from the top of the page when dragging started. The fix removes calcDragPosition from these default strategies, allowing react-draggable to use its built-in parent-relative coordinate calculation. Only createScaledStrategy retains calcDragPosition since it needs to adjust for the scale factor. Also makes calcDragPosition optional in the PositionStrategy interface, as it's only needed for custom coordinate handling (e.g., scaled containers). Bug was introduced in commit 0c80a9f which added the PositionStrategy extension point with default calcDragPosition implementations. Includes regression test to verify items don't jump during drag.
S
Samuel Reed committed
7bc6a771cdf1f0dcfc5eeaba20c6ce0d90ff76e2
Parent: 9ab22ea
Committed by GitHub <noreply@github.com>
on 12/30/2025, 1:45:06 PM