fix(draw): restore table cell resize origin - #1160
Conversation
Deploying plait with
|
| Latest commit: |
bc0690a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c25d56c4.plait.pages.dev |
| Branch Preview URL: | https://xingxing-table-resize-origin-t7hs.plait.pages.dev |
Deploying plait-docs with
|
| Latest commit: |
bc0690a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://61b08ce7.plait-docs.pages.dev |
| Branch Preview URL: | https://xingxing-table-resize-origin-nfs4.plait-docs.pages.dev |
|
Hi @nightt5879 , Please help review, I also improve text fixture in this PR! |
nightt5879
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. The overall direction looks good, and I left the higher-priority behavior and fixture notes inline. Two small, non-blocking cleanup notes:
- [P3] fixture.destroy() only traverses the current board.children, so initial nodes replaced by Immer can retain NODE_TO_PARENT / NODE_TO_INDEX entries. Keeping the initial snapshot (or all mapped nodes) for cleanup would improve test isolation.
- [P3] fill-style.spec.ts calls the same GeometryShapeGenerator.draw() twice at lines 61-62; one of the calls can be removed.
|
Also addressed the two non-blocking cleanup notes from the review in
@nightt5879 Ready for next reviewing. |
|
Thanks for the update. I went through the latest commit and the full diff again. The previous A few things still need a look:
Two minor notes: CI is green, but I’d like to see the P1/P2 cases checked before approval. |
|
Thanks for the review. The latest commit
For the items intentionally not handled in this PR:
Core type-check/build and draw build pass locally. |
|
@nightt5879 Please help me review again! |
nightt5879
left a comment
There was a problem hiding this comment.
LGTM, thanks for the updates!
|
@nightt5879 Thank you, finally I can merge it. |
Summary
Replaces the closed draft #1159 with a clean branch based on the latest
developafter #1151 landed.This fixes the table cell resize-origin case: when a cell edge is dragged away from its original size and then the pointer returns to the pointer-down position within the same resize cycle, the table should restore the original row/column size and points.
Root Cause
resizeRef.elementis captured on pointer down and remains the pointer-down element reference during the resize cycle. The board update flow is immer-backed:set_nodemutates a draft and then replacesboard.children, soresizeRef.elementstill represents the original resize baseline.When the cumulative pointer offset returns to
0, the computed target size is the original size andappliedOffsetbecomes0. The previousappliedOffset !== 0guard skipped that write, leaving the board at the previous non-zero resize frame.Change
Remove the
appliedOffset !== 0guard so the resize path applies the computed row/column state even when the effective offset is zero.Test Coverage
Added an interaction-style spec for
withTableResizethat uses the realwithDrawplugin chain and simulated pointer events:100to120and verify the first column expands to120.Verification
npm run build:drawAttempted locally but blocked by existing/local test environment issues:
npx tsc -p packages/draw/tsconfig.spec.json --noEmitstill fails on existing swimlane spec issues unrelated to this change:packages/draw/src/transforms/swimlane.spec.ts:flatMaplib / implicit any errorspackages/draw/src/utils/swimlane.spec.ts:BOARD_TO_TEMPORARY_POINTERexport errornpm run test:draw -- --watch=false --browsers=ChromeHeadlessCI --progress=false --include=packages/draw/src/plugins/with-table-resize.spec.tsexits locally during the Karma building phase with code 134 before running specs.