Skip to content

EditableText scroll with inset#24268

Open
ickshonpe wants to merge 13 commits into
bevyengine:mainfrom
ickshonpe:text-input-scroll-with-inset
Open

EditableText scroll with inset#24268
ickshonpe wants to merge 13 commits into
bevyengine:mainfrom
ickshonpe:text-input-scroll-with-inset

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 12, 2026

Objective

  • Add an inset to the scrolling view so you get some look ahead when scrolling.
  • The drag observer doesn't target the node's ContentBox.
  • Pointer edits shouldn't automatically trigger scrolling, as it moves the view relative to the pointer.

Solution

  • New component EditableTextNeedsScroll, newtypes bool. If set to true the editor view scrolls next update.
  • Don't scroll on pointer edits.
  • Scroll if dragging outside the text.
  • New scrolling view calculations in bevy_ui::widget::text_input_layout::scroll_axis_with_inset.
  • New scroll_inset field on EditableText controls the size of the view inset (is normalized).

Testing

cargo run --example multiline_text_inputs

Scrolling by dragging is too fast, and needs to be limited. Leaving it to a follow up, as this PR has a largish number of changes already.

ickshonpe added 10 commits May 12, 2026 13:03
`scroll_editable_text` scrolling calculations changed to support the inset.
…oint` when dragging. So each time the mouse moves during a drag, the current selection is cleared and a new selection is created. As long as the local drag start position is constant this is seamless, but if you scroll the text input view, the start of the drag is now at a different position relative to the text layout, and the start of the selection range changes.

Solution: Don't queue the `MoveToPoint` edit.
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 12, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Feature A new feature, making something new possible S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant