-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Number base specifiers for DragValue
and Slider
#1953
Labels
feature
New feature or request
Comments
I wouldn't like to get rid of Instead it can be coupled with a |
I see. This sounds like a good solution 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The newly added
custom_formatter
allows for, among other things, displaying numbers inDragValue
andSlider
in number systems other than decimal. What I didn't consider while adding this feature is that if you type a number into those widgets on keyboard, the input is still always parsed as a decimal number.Describe the solution you'd like
First of all, get rid of
custom_formatter
since having separate methods for the input and output allows to specify different number bases on both ends, which can be confusing and difficult to debug.Add an enum called
NumberBase
.Add new fields and methods for the
DragValue
andSlider
structs.Describe alternatives you've considered
u8
, allowing for more number systems. However, Rust's standard library doesn't provide formatting numbers with an arbitrary radix, so we would need either our own implementation for that or an additional dependency such as the radix_fmt crate.custom_formatter
comes with two drawbacks: the API breaks and the number of ways a number can be formatted becomes limited. Instead of completely replacing it with a whole new API, we could only have an additional method specifying the number base for the input. However, as I mentioned earlier, that would allow for having the inconsistency where the e.g. number would be displayed in binary but parsed in hexadecimal on input.Additional context
--
The text was updated successfully, but these errors were encountered: