diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-10-23 18:33:56 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-10-23 18:33:56 +0200 |
commit | d335155b46928d92ccd1591617318f67c647a1f4 (patch) | |
tree | 1d42fd8fe9f0bdc8861ea6728f5ffdffaa658a3a | |
parent | c21c2706ad33c59295f6a3ac1e128db6fa7cce69 (diff) | |
download | redot-engine-d335155b46928d92ccd1591617318f67c647a1f4.tar.gz |
Increase precision of RAW mode in ColorPicker
This sets the slider step to `0.001` but keeps SpinBox arrow increments
at `0.01`.
-rw-r--r-- | scene/gui/color_mode.h | 4 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/scene/gui/color_mode.h b/scene/gui/color_mode.h index bbbf3fbaac..84e9d4542d 100644 --- a/scene/gui/color_mode.h +++ b/scene/gui/color_mode.h @@ -43,6 +43,7 @@ public: 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(); }; virtual String get_slider_label(int idx) const = 0; virtual float get_slider_max(int idx) const = 0; virtual float get_slider_value(int idx) const = 0; @@ -109,7 +110,8 @@ public: virtual String get_name() const override { return "RAW"; } - virtual float get_slider_step() const override { return 0.01; } + virtual float get_slider_step() const override { return 0.001; } + virtual float get_spinbox_arrow_step() const override { return 0.01; } virtual String get_slider_label(int idx) const override; virtual float get_slider_max(int idx) const override; virtual float get_slider_value(int idx) const override; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 761298c51c..669ce11e5d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -575,9 +575,11 @@ void ColorPicker::_update_color(bool p_update_sliders) { if (p_update_sliders) { float step = modes[current_mode]->get_slider_step(); + float spinbox_arrow_step = modes[current_mode]->get_spinbox_arrow_step(); for (int i = 0; i < current_slider_count; i++) { sliders[i]->set_max(modes[current_mode]->get_slider_max(i)); sliders[i]->set_step(step); + values[i]->set_custom_arrow_step(spinbox_arrow_step); sliders[i]->set_value(modes[current_mode]->get_slider_value(i)); } alpha_slider->set_max(modes[current_mode]->get_slider_max(current_slider_count)); |