feat: add scrollable UI transform and UiScrollResult#412
Open
kuruk-mm wants to merge 3 commits into
Open
Conversation
Cherry-picks scroll-related additions from protocol-squad: - New PBUiScrollResult component (ecs_component_id 1100) - ShowScrollBar enum and ScrollPositionValue message - element_id, scroll_position, scroll_visible fields on PBUiTransform
Test this pull request
|
element_id is the element's own unique name (HTML-id-like), registered in a named-node table consumed by ScrollPositionValue.reference and the UI focus RPC — not merely a "reference for scroll_position".
3 tasks
Match the value already in use on protocol-squad so the two branches agree on the component ID.
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.
Summary
Proposes adding scrollable UI containers and a programmatic way to observe / control their scroll state. Verified against the reference renderer in
bevy-explorer(crates/scene_runner/src/update_world/scene_ui/mod.rs,crates/ui_core/src/scrollable.rs), which already wires these fields end-to-end.What this adds
PBUiScrollResult— new component (ecs_component_id = 1202)Renderer → scene. The renderer writes the viewport's current scroll offset back to the scene whenever the user scrolls (wheel, drag, or programmatic move), letting scene logic react to scroll state.
ui_transform.protoadditionsShowScrollBarenum — which scroll bars are visible on a scrollable node:SSB_BOTH(default) — horizontal + verticalSSB_ONLY_VERTICALSSB_ONLY_HORIZONTALSSB_HIDDEN— no bars (content still scrollable via wheel/drag)ScrollPositionValuemessage —oneof:position(Vector2) — literal scroll offsetreference(string) —element_idof a descendant; the renderer scrolls the viewport so that element is visibleThree new optional fields on
PBUiTransform:element_idid-like). Registered in a named-element table so other components/RPCs can refer to it by name. Today consumed byScrollPositionValue.referenceand the UI focus RPC. Default: empty.scroll_positionoverflow = YGO_SCROLL. Default:position=(0,0).scroll_visibleSSB_BOTH.Proposed usage
1. Make a node scrollable
2. Set scroll position imperatively
3. Scroll a named child into view
4. React to user scrolling
Test plan
make buf-lintpassesmake buf-buildpassesPBUiScrollResultread-back