-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix unnecessarily quantizing current color in color picker #85749
Fix unnecessarily quantizing current color in color picker #85749
Conversation
For the record, your commit seems not to be linked to your GitHub account. See: Why are my commits linked to the wrong user? for more info. |
170db96
to
1b85b8f
Compare
Oh, thanks for the heads-up! Should be linked to the correct account now. Thanks! |
Good work catching the error in my pr. I think this pr could be better fit to be modified, and I don't currently have time to work on it, so feel free to borrow from my solution. |
I will, thanks! And I only caught that error because I spent quite some time pulling my hair out when I was working on my own PR wondering how on Earth it still managed to get the wrong color value through to the caller despite me having breakpoints everywhere. 😅 |
1b85b8f
to
974656f
Compare
Made the HTML field send change events based on whether the new color's string is different from the previous color's string (instead of whether the new string parses to the current color value). Previously, updating the color value even when the corresponding string hadn't changed would unnecessarily quantize the color value to 8 bits just by opening/closing the Color Picker.
974656f
to
21d778b
Compare
Thanks! |
Cherry-picked for 4.2.2. |
Fixes #85743.
The color picker would update the current color to match the HTML string whenever the parsed value did not match the current color. Since Godot Colors have a 16 bit resolution, this would quantize the current value to the nearest HTML color even when no change was made. And since this happened whenever the HTML input lost focus, just opening and closing the color picker was enough to change a 16-bit value to the nearest 8-bit value.
With this PR, the HTML input only updates the current color when the HTML representation is different from the current color's HTML representation (and not whenever the HTML representation represents a different color than the current one).