#bevy_ui scroll widget retrospective

6 messages · Page 1 of 1 (latest)

jagged yarrow
#

Hi, I wrote a pure bevy_ui scroll widget. While I'm not intending to publish this as a crate, I've been refining it towards having a sane user-facing API as an exercise. Doing so has been difficult. I'd like to explain my primitives and their shortcomings, then ask some questions. Forgive the novel. rubberduck

<snip> _all irrelevant now because i changed everything _ </snip>
Refactored version might be worth a look. Found some patterns I like, gonna see if they generalize nicely.

https://github.com/Piefayth/bevy_ui_scroll

nova glacier
jagged yarrow
#

Oh, cool! Thanks for pointing this out.

Definitely agree with the direction, and the fact that we need overflow-x/y 😅 . Gonna look at that PR too. Any plan for management of the scrolled items? Offscreen items getting hit with a re-layout scaled pretty poorly pretty quickly for me.

Is mousewheel / touchpad the full intended scope of bevy_ui handled scroll inputs? I'm thinking about touch/drag on mobile, middle click to get the scroll widget on desktop web, etc. "Left click the scroll bar" too, but that doesn't really apply here yet.

nova glacier
#

Any plan for management of the scrolled items? Offscreen items getting hit with a re-layout scaled pretty poorly pretty quickly for me.

So plan for regular scrollviews is that that they will have no special handling of offscreen items (they'd be laid out like usual, but the drawing would be clipped). But this doesn't apply the offset via style props, so no relayout is required on scroll.

#

I still think a separate "virtual scrollview" that only rendered/laid out in-view items would be a good idea.

#

Is mousewheel / touchpad the full intended scope of bevy_ui handled scroll inputs? I'm thinking about touch/drag on mobile, middle click to get the scroll widget on desktop web, etc. "Left click the scroll bar" too,

I'd want to support all of those. This PR is just still pretty incomplete atm. I hadn't considered mobile/touch scrolling, but I've started work on reserving space for scrollbars in the layout. I think I can probably handle scrollbars as an orphaned UI node (no parent), but I haven't looked into how to manage the spawn/despawn lifecycle of that yet.