Store a resize on release and settle its position a frame later - #231
Conversation
A resize waited one frame after release before storing, so the final size was laid out. A page switch inside that frame could land the resize on the next page's copy of the item, which keeps the same id. Pointer events arrive between frames, and a frame builds and lays out together. So on release the box on screen always matches the size it was last built at. Storing that size with the rendered box makes the commit synchronous and exact. A final move the frame never drew is dropped, so the box stays where the user last saw it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Storing the size last drawn at release dropped movement that arrived after the last frame: a quick drag could be lost entirely. Go back to storing the final size one frame after release, when it is laid out. Write it only if the text or image being resized is still loaded. A page switch in that frame loads the next page's copy, which keeps the same id, so the resize can no longer land on it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comments Outside DiffThese findings could not be posted inline.
|
With the write deferred a frame, a page save right after release still read the old size, and the page switch then replaced the item, so the resize was lost. Store the size, and a position from the current layout, as soon as the handle is released. Hold the pin one more frame, then store the position again if the final layout moved it, only while the same item is still loaded. Normally that second write finds nothing to change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Follow-up to #226, from Greptile's review of the matching desktop PR #227.
#226 stores a resize one frame after release, once the final size is laid out. If the user switched pages inside that frame, the write could land on the next page's copy of the item, because adjacent-page copies keep the same id.
Now the size, plus a position from the current layout, is stored synchronously on release, so a page save right after sees it. The pin holds for one more frame. Once the final size is laid out, the position is stored again if it moved, but only while the provider still holds the exact object that was resized. A page switch loads fresh objects, so the next page's copy is never touched. Normally that second write finds nothing to change.
(Earlier commits here tried two narrower fixes. Storing only the last drawn size dropped movement that arrived after the last frame. A guard alone let a page save right after release miss the resize. Greptile caught both.)
Tests (
test/placed_box_resize_test.dart)a release before the next frame keeps its last movement: a move and the release arrive with no frame between them, and the box ends with that final movement.a page switch right after release keeps the resize on its page: the resized item has its new width before any frame. Then another page's copy with the same id loads before the frame, and the copy's size and position stay unchanged.flutter test --no-pub: 1317 passed.dart analyzeis clean on touched files.🤖 Generated with Claude Code
The confirmed position error should be fixed before merging.
Findings
Summary
The PR saves text and image resizes immediately on release so a quick page switch retains the new size. On defense, that save can pair the new size with a position calculated from the previous layout. Reopening the page then visibly moves the resized item.
Reviews (3) · Last reviewed commit: "Store a resize's size on release and set..."