Repository navigation
Merged
Conversation
A box given `glideMs` is drawn from where it was when layout moves it in its parent, and closes the gap over that many milliseconds, slowing as it arrives, with everything it holds. A tab strip slides to centre the open tab, a selection bar runs between rows, and a position marker travels along its track, each for one React render rather than one a frame. - A move during a glide sets off from where the box is drawn then, so quick moves run on into each other. - Only a move in its parent glides: a box appears in place, and a scroll or a move of its parent carries it at once. Layout keeps each box's offset in its parent (Place::inParentX, inParentY) for this, as its rect moves with every scroll. - Under reduced motion the box stands in its new place at once. - The pointer meets the box where it is drawn: hit testing reads the glide's shift as it reads an animation's. Each has its doctest in tests/view_test.cpp. Claude-Session: https://claude.ai/code/session_015YsDT2R1ktGozfGHLod1JN
A box moved by an animation or a glide inside a box that clips carried the clip of everything it holds along with it: paint offset a descendant's clip by the descendant's own shift, though the clip is the edge of the box that clips, which hadn't moved. A tag gliding in a strip that clips had its text cut where the strip's edge would be had the strip glided too, and the pointer missed what showed of it. Paint now keeps the shift of the nearest box that clips (Scroll, or overflow "hidden") apart from the node's own, and offsets clips by it, in paint and in what hit testing reads (PaintedShift::clipDx, clipDy). Each half has its doctest in tests/view_test.cpp. Claude-Session: https://claude.ai/code/session_015YsDT2R1ktGozfGHLod1JN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits. The first adds a way to animate a layout change; the second fixes a clipping bug that the first exposed but that already hit any translated animation inside a box that clips.
A box glides to where layout moves it
A
BoxgivenglideMsis drawn from where it was when layout moves it in its parent, and closes the gap over that many milliseconds, slowing as it arrives (a cubic ease-out), with everything it holds. Until now an animation could only play a token's fixed keyframes, so nothing could follow a move whose size depends on the layout: a tab strip sliding to centre the open tab when the tabs' widths differ, a selection bar running between rows, a marker travelling along a track. Each now costs one React render per change, not one per frame.Place::inParentX,inParentY, Yoga's own left and top), because its rect moves with every scroll and every sticky shift.What a moved box holds is clipped where its clipping box is drawn
Paint offset a node's clip, which is the edge of an ancestor that clips (a
Scroll, oroverflow: "hidden"), by the node's own accumulated shift. When a box between the clipping ancestor and the node was moved by an animation or a glide, the clip moved with it, though the clipping box hadn't moved. A tag gliding along a strip that clips had its text cut where the strip's edge would have been had the strip glided too, and a row coming in from the left with atranslateXanimation had its right side cut. The pointer missed what showed, the same way.Paint now keeps the shift of the nearest box that clips (
PaintState::clipDx,clipDy) apart from the node's own, offsets clips by it, and records it for hit testing (PaintedShift::clipDx,clipDy).Tests
tests/view_test.cpp, 10 new doctests: a gliding box appears in place and owes no frames; a move glides from where the box was drawn (7/8 of the way at half time); it owes frames until it arrives; a move mid-glide sets off from where it is drawn; a move of its parent or a scroll carries it at once; reduced motion jumps; the pointer hits it where it is drawn; and, for the clip, a translated box's content keeps its clipping box's clip (failed before: 150px wide, not 200), and the pointer meets that content inside it (failed before: the hit went to the parent). All 288 C++ and 364 TypeScript tests pass.Where it's used
XLR8's garage files its parts by category on a rail turned with LB/RB. The rail, its position marker and the selection bar glide; the rows come in on staggered token animations. It runs with this branch vendored while it's reviewed.
https://claude.ai/code/session_015YsDT2R1ktGozfGHLod1JN