Commit Graph

8 Commits

Author SHA1 Message Date
ickshonpe e52d2c5c53 Justify the inputs in the multiple_text_inputs example (#24583)
# Objective

Make the `multiple_text_inputs` example a bit more useful by giving each
text input a different justification, which should help with debugging
cursor behaviour.

## Solution

Add an input for each `Justify` variant along with a column on the left
labelling the justification it is using.

## Showcase

<img width="1798" height="750" alt="inputs-justified"
src="https://github.com/user-attachments/assets/324c1cd4-b6a1-4c0f-ad1a-38cd28867704"
/>
2026-06-10 17:57:58 +00:00
ickshonpe a382a230a2 multiple_text_input example layout fixes (#24294)
# Objective

These are meant to be single line inputs, but:

<img width="1552" height="954" alt="image"
src="https://github.com/user-attachments/assets/5e7ab2c7-9bb2-46cd-9a42-bca36b933837"
/>

A mess!

## Solution

1. Add `TextLayout::no_wrap()` to each input and their outputs.
2. Add an intermediate node wrapping each output node applying clipping
to hide the overflow.

<img width="1608" height="489" alt="fixed-inputs"
src="https://github.com/user-attachments/assets/22dc436c-e677-4b1f-a569-d3a9c9effc1c"
/>

## Testing

```
cargo run --example multiple_text_inputs  --features="system_clipboard"
```
2026-05-21 10:16:40 +00:00
ickshonpe 10db67e459 multiple_text_inputs example: Navigate to next input on submission (#24295)
# Objective

In the `multiple_text_inputs` example, the input focus should move to
the next text input after the user submits the input's contents.

## Solution

- In `submit_text`, after submission, use the `TabNavigation` system
param to find the next input, and set it as the `InputFocus`.
- Submit on just `Enter`. The `Ctrl` + `Enter` chord should be reserved
for inputs that allow new lines.
2026-05-21 09:26:17 +00:00
Alice Cecile 90b41543e2 Improve default colors for text_input widgets (#23960)
# Objective

- Text input is one of the headline feature in Bevy 0.19.
- Our defaults are currently very ugly, and shown across our user-facing
text examples.
- Good default matter for user perception of quality, and to make quick
prototyping easier.
- Additionally, the layout in the text_input example is erratic in a way
that looks poorly made.

Fixes #23955.

## Solution

1. Clean up the default colors for text input by picking boring,
uncontroversial tailwind colors.
2. Change the css::YELLOW borders in our text input examples to
something neutral that looks nice with our background.
3. Fix up the layout for the `text_input` example so it's both simpler
and looks much better.

## Testing

`cargo run --example text_input`

## Showcase

Before:

<img width="873" height="773" alt="image"
src="https://github.com/user-attachments/assets/bcc70bf6-e6b1-4bf4-b671-7924ac24e984"
/>

After:

<img width="757" height="274" alt="image"
src="https://github.com/user-attachments/assets/e1a3e325-b3a7-4a9b-831e-6886e6a818fc"
/>
2026-04-24 05:21:39 +00:00
ickshonpe 8b8a432ab4 EditableText change detection using parley::Generation (#23785)
# Objective

Improved change detection for `EditableText`.

Fixes #23793

## Solution

* Remove the `text_edited` field from `EditableText` that was used for
manual change detection.
* Use the `PlainEditor`'s `Generation` to track changes.
* New component `EditableTextGeneration`. Newtypes `parley::Generation`.
Stores the generation from the last `TextLayoutInfo` update.
* If `EditableText::editor`'s and `EditableTextGeneration`'s generation
values aren't equal, reupdate `TextLayoutInfo`.
* Added support for `TextLayout::justify`.
* Split up `editable_text_system` into two systems
`update_editable_text_styles` and `update_editable_text_layout`. The
text input's style values need to be updated before layout, so the
measure func returns the correct size for the text layout.
* New `EditableText` `testbed_ui` scene.
* Added two numeric inputs to `multiline_text_input` that allow you to
set the height of the multiline input and its fontsize.
* Update selection rects on all changes, not just when a text input is
focused.

## Testing

```
cargo run --example multiline_text_input
```

The cursor appears to be missing for the numeric inputs in the example
but it isn't. The cursor gets clipped because it's at the end of the
right aligned input value text. If you press left it comes into view.
Cursor and scrolling behaviour needs some adjustments but that's out of
the scope of this PR.
2026-04-19 18:38:47 +00:00
ickshonpe b83d130bd7 EditableText::new method to set initial text (#23702)
# Objective

It should be simple to set an initial value for `EditableText`'s text
buffer.

Otherwise I can see users struggling with this and using some ghastly
construction like a run once system in `Update` to set initial text.

## Solution

New `EditableText::new` method. The value of the text buffer is set
immediately and a `TextEdit::TextEnd(false)` edit is queued to move the
cursor to the end of the text.


## Testing

Added some initial text to the multiple text example:

```
cargo run --example multiple_text_inputs
```
2026-04-12 20:43:22 +00:00
Luke Yoo 09ef09eaa5 UiWidgetsPlugins and InputDispatchPlugin are now in DefaultPlugins (#23346)
# Objective

-
[Overview](https://hackmd.io/@UrWywBGGTV6bLjORZhuuPw/BJNPlNCu-g#Overview)
- `UiWidgetsPlugins` is part of `DefaultPlugins`
- Prerequisite for [Remove `Interaction` from
`examples/*`](https://github.com/bevyengine/bevy/pull/23285)

## Solution

- `UIWidgetsPlugins` adds `InputDispatchPlugin`.
- `UIWidgetsPlugins` and `InputDispatchPlugin` are removed from
`FeathersPlugins`.
- `UIWidgetsPlugins` slips into `DefaultPlugins`.

## Testing

Following examples are relevant:
- examples/ui/widgets/feathers.rs
- examples/games/game_menu.rs

## Also

[Migration
Guide](https://github.com/micttyoid/bevy/blob/ui-widgets-to-default-2/_release-content/migration-guides/ui_widgets_plugins_and_input_dispatch_plugin_are_now_default.md)
- Also: e7bab9fb83

[TODO after merge](#issuecomment-4057934697)

---------

Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
2026-04-02 18:46:41 +00:00
ickshonpe 7dcc2244a9 New multiple_text_inputs example. (#23579)
# Objective

Add another text input example

## Solution

Grid layout with three rows of input, immediate updated copy of its
text, and submitted text.
2026-03-31 16:14:14 +00:00