-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Number input polish #24701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+83
−7
Merged
Number input polish #24701
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7c6dd52
Add scrubbing / dragging to number_input widget.
viridia 3ccfe1d
CI
viridia a6f869d
Rebuild examples.
viridia 4bb456a
* Don't allow focus when disabled
viridia 8921e43
Typo
viridia 0eee4ae
Apply suggestions from code review
viridia 72c6134
Review feedback
viridia d04da2e
Add release notes and migration guide for number_input.
viridia 7bbc812
Merge remote-tracking branch 'upstream/main' into number_input_stuff
viridia dee1479
PR numbers.
viridia 7b03b3e
Bad merge.
viridia cc70029
Typo
viridia 1027289
Update doc
viridia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| title: "Add scrubbing / dragging to number_input widget" | ||
| pull_requests: [24636, 24701] | ||
| --- | ||
|
|
||
| The API for the `FeathersNumberInput` has changed. To programmatically update the value, instead | ||
| of triggering an `UpdateNumberInput` event, you should insert a `NumberInputValue` component. | ||
| This makes it easier to specify the initial value at creation. | ||
|
|
||
| ```wgsl | ||
| // BEFORE | ||
| commands.trigger(UpdateNumberInput { | ||
| entity: input_ent, | ||
| value: NumberInputValue::F32(new_value), | ||
| }); | ||
|
|
||
| // AFTER | ||
| commands | ||
| .entity(input_ent) | ||
| .insert(NumberInputValue::F32(new_value)); | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| title: "Add scrubbing / dragging to number_input widget" | ||
| authors: ["@viridia"] | ||
| pull_requests: [24636, 24701] | ||
| --- | ||
|
|
||
| The `FeathersNumberInput` widget has been substantially overhauled, with several new features. | ||
|
|
||
| Bevy's editor design draws heavily from Blender, particularly in its | ||
| [numeric input fields](https://docs.blender.org/manual/en/latest/interface/controls/buttons/fields.html), | ||
| which support multiple editing modes — including "scrubbing" (click-and-drag) and direct keyboard | ||
| entry. The updated feathers widget is now much closer to feature parity with Blender. | ||
|
|
||
| The widget supports editing numbers of different data types: `f32`, `f64`, `i32` and `i64`. | ||
|
|
||
| The behavior of the widget can be configured through the use of several optional components: | ||
|
|
||
| - `HardLimit` specifies the minimum and maximum range for the value. If this component is absent, | ||
| then the natural range of the data type is used. | ||
| - `SoftLimit` specifies the range that is accessible via dragging. Numbers that are entered by | ||
| typing can exceed this limit. | ||
| - `NumberInputPrecision` is used to specify the number of decimal points of precision when dragging, | ||
| so that you don't get a bunch of digits jumping around. This only quantizes the value when | ||
| dragging, not when typing. | ||
| - `Step` is used to indicate the delta value when incrementing and decrementing. | ||
|
|
||
| When `SoftLimit` is present, the widget will look and feel like a slider: it will draw a slide | ||
| bar in the background, and the drag speed will be calculated such that changes in the bar's size | ||
| will be synchronized with movement of the mouse. | ||
|
|
||
| If `SoftLimit` is _not_ present, then the widget behaves more like a "scrubber", where there is | ||
| no slide bar, and drag speed is calculated based on a heuristic that takes into account precision, | ||
| step, and the current input value. | ||
|
|
||
| In either of this cases, a non-drag click event will activate "typing" mode, where a value can | ||
| be entered by typing digits. | ||
|
|
||
| Like all feathers widgets, this is a "controlled" widget, which means that the internal numeric | ||
| value is not automatically updated, but instead relies on the application's event handlers to | ||
| update the widget state in response to `ValueChange` events. Check out the `feathers_number_input` | ||
| example to see how to write such a handler trivially. | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.