diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-21 23:36:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-21 23:36:19 +0100 |
commit | 14f6f92a721dfa1a0467147e7b70b7427c97be77 (patch) | |
tree | 10a3c64640cf18de02de4f25d13af56efac078a7 /scene | |
parent | 54a1b0a2a4d7fbe6385b8ee1e0587da3b1f6115d (diff) | |
parent | 27749711b2ebb8f67f793986fe83e88aa7bad149 (diff) |
Merge pull request #46230 from gongpha/keep-hue-value
Keep Hue value when Saturation or Value is zero
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/color_picker.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index b82c078a2d..e8586b72e9 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -166,10 +166,13 @@ void ColorPicker::_value_changed(double) { } if (hsv_mode_enabled) { - color.set_hsv(scroll[0]->get_value() / 360.0, - scroll[1]->get_value() / 100.0, - scroll[2]->get_value() / 100.0, - scroll[3]->get_value() / 255.0); + h = scroll[0]->get_value() / 360.0; + s = scroll[1]->get_value() / 100.0; + v = scroll[2]->get_value() / 100.0; + color.set_hsv(h, s, v, scroll[3]->get_value() / 255.0); + + last_hsv = color; + } else { for (int i = 0; i < 4; i++) { color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0); |