Browse Source

Keep Hue value when Saturation or Value is zero

(cherry picked from commit 27749711b2ebb8f67f793986fe83e88aa7bad149)
Kongfa Waroros 4 years ago
parent
commit
af5fe70623
1 changed files with 7 additions and 4 deletions
  1. 7 4
      scene/gui/color_picker.cpp

+ 7 - 4
scene/gui/color_picker.cpp

@@ -171,10 +171,13 @@ void ColorPicker::_value_changed(double) {
 		return;
 
 	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);