-
Notifications
You must be signed in to change notification settings - Fork 189
Integrate understory #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Integrate understory #998
Conversation
|
the biggest change here is event handling. there is a new src/context/event.rs file that does the new event handling. It does the dispatch of pointer events using understory_box_tree which allows for fast hit testing. The box tree is updated after doing taffy layout and it integrates any visual transformation (scale/rotation/scroll offset) so that we get correct hit testing for targets that have transformed after layout. because scroll offsets are now treated as a visual transform along with the others I needed to rework both the scroll and virtual list widgets. While working on event handling I have made it so that event handlers get both mutable access to an EventCx and also mutable access to the View. This is largely why so many files have changed. I have also reworked layout to be push based. So there is no layout pass, views need to push changes to the taffy tree (which is not mostly done automatically by Floem) and request layout or push properties into the box tree and request box tree commit. Views can request a function run post layout if needed but this is not run by default. to do removal of the layout pass I needed to rework text layout so that we use the custom taffy measure functions. This has a nice benefit of making it so that layout with line breaking can run in a single pass and we don't have to round trip multiple times to the view update and back to layout. This makes a noticeable improvement to paint latency, so now when resizing the window, even in debug mode, when there is lots of linebreaking, we still repaint before the frame deadline. Styling is now cached so dirty tracking is done in the window state and an explicit style traversal is created to only style the necessary views. paint has changed as well a bit (there are some bugs I just haven't fixed yet) so that they get the final visual position correctly from the box tree |
|
I can't see understory in crates.io. How are we going to publish floem? |
@waywardmonkeys are we good to do some initial releases soon? I don't think there will be any pushback to that |
|
important for me, conceptually this enables the separation of a "visual ID" from a View. We can use box tree node ids as a visual id for a rectangle on the screen and support hit testing, interaction states, event targeting, and updates for those rectangles with identifiers without needing to have the full overhead of a View. https://xi.zulipchat.com/#narrow/channel/550935-understory/topic/Floem.20Integration/near/563959235 I wrote a bit here on a nice pattern this enables. this is useful for any app that wants to control the layout or lifecycle of elements on the screen without needing to reimplement a whole ui library just to get hit testing and interaction states and final screen positioning |
24a88d7 to
c4fcc16
Compare
|
Currently I am using main branch understory and this open pr. I'd actually like to move away from needing that PR though. currently I need it because we only have one box tree per app, in the same way we only have one taffy tree per app. but for performance reasons we should really have one spatial index/box tree per window. I haven't done this because when view state is built, it isn't yet determined which window/root that view belongs to so we can't know which box tree should be providing the node id. We could initialize it lazily but that felt a bit ugly, it might be best though. other things that aren't done / need fixed
|
This has a bunch of changes that all came as a result of integrating understory but that's made it quite a large change