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] Use rounded values for checking if value needs setting #2959

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kamirr
Copy link

@kamirr kamirr commented Apr 26, 2023

If old_value is not rounded, the modified if-expression would always trigger clearing the edit memory, and hence making editing by keyboard impossible -- the edit buffer would only last a single frame.

Alternatively, old_value could be always rounded if we rounded the result of parsing the keyboard input and accesskit input, but this prevents the user from inputting values more precise than allowed by default, which is a behavior I've personally found useful. Regardless of that, this solution is more likely to prevent this bug from being reintroduced if new input methods are added and don't respect rounding.

If the old value is not rounded, the modified if-expression would always
trigger clearing the edit memory, and hence making editing by keyboard
impossible -- the edit buffer would only last a single frame.

The old_value could also be always rounded if we rounded the result of
parsing the keyboard input, but this prevents the user from inputting
values more precise than allowed by default, which I think is a useful
behavior worth keeping.
@kamirr kamirr marked this pull request as draft April 26, 2023 10:48
@kamirr
Copy link
Author

kamirr commented Apr 26, 2023

./scripts/check.sh fails due to the following:

+ cd crates/egui_glow
+ cargo check --all-features
   Compiling smithay-client-toolkit v0.16.0
   Compiling wayland-protocols v0.29.5
   Compiling winit v0.28.1
    Checking epaint v0.21.0 (/home/kamil/workspace/egui/crates/epaint)
    Checking egui v0.21.0 (/home/kamil/workspace/egui/crates/egui)
error: The platform you're compiling for is not supported by winit
  --> /home/kamil/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.1/src/platform_impl/mod.rs:67:1
   |
67 | compile_error!("The platform you're compiling for is not supported by winit");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I don't think it's relevant to this patch. @emilk can I mark it as ready for review despite this failure?

@kamirr kamirr marked this pull request as ready for review May 11, 2023 21:01
@emilk emilk added the egui label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants