Skip to content
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

DragValue with min_decimals set to 1 formats 0.0 as 0 #4610

Closed
Skgland opened this issue Jun 5, 2024 · 1 comment · Fixed by #4639
Closed

DragValue with min_decimals set to 1 formats 0.0 as 0 #4610

Skgland opened this issue Jun 5, 2024 · 1 comment · Fixed by #4639
Labels
bug Something is broken

Comments

@Skgland
Copy link

Skgland commented Jun 5, 2024

Describe the bug
With min_decimals set to one all values should be displayed with at least one decimal,
but 0 is displayed instead of 0.0

To Reproduce
Create a UI containing a DragValue with min_decimals set to 1 and with a current value of 0.0.
e.g.
ui.add(egui::DragValue::new(&mut 0.0).min_decimals(1))

Expected behavior
min_decimals is honored and 0.0 is displayed.

Screenshots

image

Desktop (please complete the following information):

  • OS: Ubuntu Jammy 22.04 under WSL 2/ Debian Bullseye
  • Version 0.25.0

Additional context

This is probably due to this special case:
https://github.com/emilk/egui/blob/master/crates/egui/src/widgets/drag_value.rs#L456-L458

@Skgland Skgland added the bug Something is broken label Jun 5, 2024
@YgorSouza
Copy link
Contributor

It looks like this special case was added in ebc2486#diff-3878bfa9f60333dd78982f3697643c6755ff8378f18b54fff03973c1eff5fcc8L159-R173 more than 3 years ago, and kept this way ever since. But I don't know what is the reasoning behind it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants