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

Increase precision of RAW mode in ColorPicker #83851

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 23, 2023

This sets the slider step to 0.001 but keeps SpinBox arrow increments at 0.01.

Thanks @aXu-AP for the suggested fix 🙂

Preview

simplescreenrecorder-2023-10-23_18.32.31.mp4

This sets the slider step to `0.001` but keeps SpinBox arrow increments
at `0.01`.
@Calinou Calinou requested a review from a team as a code owner October 23, 2023 16:34
@Calinou Calinou added this to the 4.2 milestone Oct 23, 2023
@fire fire requested a review from a team October 23, 2023 16:52
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserving the precision is a good goal.

@aXu-AP
Copy link
Contributor

aXu-AP commented Oct 23, 2023

Just as I imagined it 👍

@@ -43,6 +43,7 @@ class ColorMode {

virtual int get_slider_count() const { return 3; };
virtual float get_slider_step() const = 0;
virtual float get_spinbox_arrow_step() const { return get_slider_step(); };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be const = 0;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it should have a default value so that individual color modes aren't required to implement this method.

Copy link
Contributor

@aXu-AP aXu-AP Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 is the default value for SpinBox.custom_arrow_step, it will be ignored. From docs:

float custom_arrow_step = 0.0
If not 0, value will always be rounded to a multiple of custom_arrow_step when interacting with the arrow buttons of the SpinBox.

But defining it explicitly doesn't hurt either, I'm happy either way 🙂

@akien-mga akien-mga merged commit 2dc932e into godotengine:master Oct 24, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the colorpicker-raw-mode-increase-precision branch October 25, 2023 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Color value changes on update of alpha values in color Editor
4 participants