Skip to content

Commit

Permalink
Fix ColorPicker inactive left side sample reset
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 028921b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,9 @@ void ColorPicker::_update_text_value() {
}

void ColorPicker::_sample_input(const Ref<InputEvent> &p_event) {
if (!display_old_color) {
return;
}
const Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
const Rect2 rect_old = Rect2(Point2(), Size2(sample->get_size().width * 0.5, sample->get_size().height * 0.95));
Expand Down Expand Up @@ -1126,7 +1129,7 @@ void ColorPicker::_sample_draw() {

if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the new color is "overbright" and can't be displayed accurately in the preview.
sample->draw_texture(theme_cache.overbright_indicator, Point2(uv_edit->get_size().width * 0.5, 0));
sample->draw_texture(theme_cache.overbright_indicator, Point2(display_old_color ? sample->get_size().width * 0.5 : 0, 0));
}
}

Expand Down

0 comments on commit 028921b

Please sign in to comment.