mirror of
https://github.com/bevyengine/bevy.git
synced 2026-07-01 00:05:45 -04:00
4b0579b18d
# 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>