Skip to content

Commit

Permalink
Fix RGB/RAW ColorMode jank sliders and spinbox
Browse files Browse the repository at this point in the history
(cherry picked from commit blazium-engine/blazium@f7c6762)

Co-authored-by: Mounir Tohami <53877170+WhalesState@users.noreply.github.com>
  • Loading branch information
Spartan322 and WhalesState committed Oct 24, 2024
1 parent 07f92e6 commit 7a16a43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions scene/gui/color_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ String ColorModeRGB::get_slider_label(int idx) const {

float ColorModeRGB::get_slider_max(int idx) const {
ERR_FAIL_INDEX_V_MSG(idx, 4, 0, "Couldn't get slider max value.");
Color color = color_picker->get_pick_color();
return next_power_of_2(MAX(255, color.components[idx] * 255.0)) - 1;
return slider_max[idx];
}

float ColorModeRGB::get_slider_value(int idx) const {
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/color_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ColorModeHSV : public ColorMode {
class ColorModeRGB : public ColorMode {
public:
String labels[3] = { "R", "G", "B" };
float slider_max[4] = { 255, 255, 255, 255 };

virtual String get_name() const override { return "RGB"; }

Expand All @@ -108,12 +109,11 @@ class ColorModeRGB : public ColorMode {
class ColorModeRAW : public ColorMode {
public:
String labels[3] = { "R", "G", "B" };
float slider_max[4] = { 100, 100, 100, 1 };
float slider_max[4] = { 1, 1, 1, 1 };

virtual String get_name() const override { return "RAW"; }

virtual float get_slider_step() const override { return 0.001; }
virtual float get_spinbox_arrow_step() const override { return 0.01; }
virtual float get_slider_step() const override { return 1.0 / 255.0; }
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;
Expand Down

0 comments on commit 7a16a43

Please sign in to comment.