Commit 4b0579b
Add scrubbing / dragging to number_input widget. (#24636)
# Objective
Part of #19236
This PR is a near-total rewrite of the feathers number input widget.
This version adds the ability to edit the value by dragging,
behaviorally similar to the widgets in Blender.
## Features
* Click to edit textually
* Drag to adjust
* Adaptive drag speed heuristic
* Conditional slider bar (only appears if soft limits are specified)
* Soft and hard limits (ref. [Blender
documentation](https://docs.blender.org/manual/en/latest/interface/controls/buttons/fields.html#number-fields))
* Precision and step options
* Cursor shape changing
* Support for different number formats: f32, f64, i32, i64
## Backwards compatibility
The method for programmatically updating the edited value has changed to
be more consistent with other widgets - instead of sending an event, you
now insert a `NumberInputValue` component with the new value.
## Testing
- extensive manual testing via a new example, `feathers_number_input`.
## Additional Information
Things left to do:
* Visible increment / decrement arrows (only for fields with no soft
limit)
* Support for unit conversions and units display (meters, centimeters,
degrees, etc.)
* The theme colors are not final; there's some debate about whether we
will need to implement multiple thematic variations of this widget in
order to maintain sufficient contrast against different backgrounds.
* Accessibility support needs work.
* The example has some placeholder labels that we supposed to mirror the
input value, but that has not been finished.
* Does not enable drag capturing in CursorOption because bevy_picking
doesn't work with captured pointers.
Note: because of the complexity of this widget, it does not use the
"slider" headless widget, and instead is based on the `EditableText`
component, with slider-like behaviors layered on top.
Also, this widget pretty much subsumes all of the functionality of the
feathers slider, making the latter unnecessary. The only advantage of
`FeathersSlider` is that, since it only supports `f32`, it has a simpler
API.
---------
Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>1 parent fa11904 commit 4b0579b
8 files changed
Lines changed: 1319 additions & 209 deletions
File tree
- crates/bevy_feathers/src
- controls
- examples
- ui/widgets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5497 | 5497 | | |
5498 | 5498 | | |
5499 | 5499 | | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
5500 | 5512 | | |
5501 | 5513 | | |
5502 | 5514 | | |
| |||
0 commit comments