Commit 6d62b86
committed
fix: preserve position during SE/S/E resize to prevent rounding drift
During resize events, _dragOrResize unconditionally recalculates x/y
from pixel positions for all handle directions. For SE/S/E handles,
the top-left corner is anchored and should never move. The pixel→grid
round-trip through Math.round() introduces rounding errors that cause
position drift, especially on fine grids with small cell sizes (e.g.
column:480, cellHeight:'0.38vh' ≈ 3.5px per cell).
This fix:
- Passes the resize handle direction (dir) from DDResizable._resizing()
through the event object as event.resizeDir
- In _dragOrResize, only recalculates x/y when the handle moves the
top-left corner (contains 'n' or 'w')
- For SE/S/E handles, preserves the original position from node._orig
Since p is initialized from { ...node._orig }, x/y naturally keep their
original values when not overwritten.
Fixes #385, relates to #811, #13561 parent f177f71 commit 6d62b86
2 files changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2928 | 2928 | | |
2929 | 2929 | | |
2930 | 2930 | | |
2931 | | - | |
2932 | | - | |
2933 | | - | |
2934 | | - | |
2935 | | - | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
2936 | 2941 | | |
2937 | 2942 | | |
2938 | 2943 | | |
| |||
0 commit comments