summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-15 12:48:23 +0200
committerGitHub <noreply@github.com>2022-06-15 12:48:23 +0200
commit778a9fce77322b1f0ab3014d586f2c451dc56da2 (patch)
tree3e839cbe1f413b66ee3560cf48085bc47916d719
parent4bbe7f0b98de72d6dd77d5ade4b761de375bcf66 (diff)
parentfd285e19edd37111f0e61004ed7a25d3540dbe7e (diff)
Merge pull request #61997 from Rindbee/fix-ColorPicker-wrong-sampling
Fix wrong sampling in ColorPicker
-rw-r--r--scene/gui/color_picker.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 5fff1e1df3..28d645e8f6 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -1108,7 +1108,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
Ref<Image> img = r->get_texture()->get_image();
if (img.is_valid() && !img->is_empty()) {
Vector2 ofs = mev->get_global_position() - r->get_visible_rect().get_position();
- Color c = img->get_pixel(ofs.x, r->get_visible_rect().size.height - ofs.y);
+ Color c = img->get_pixel(ofs.x, ofs.y);
set_pick_color(c);
}
@@ -1135,6 +1135,8 @@ void ColorPicker::_screen_pick_pressed() {
screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input));
// It immediately toggles off in the first press otherwise.
screen->call_deferred(SNAME("connect"), "hidden", Callable(btn_pick, "set_pressed"), varray(false));
+ } else {
+ screen->show();
}
screen->raise();
#ifndef _MSC_VER