From ef48c4d306fae2b819e937509b663aef9e285f7a Mon Sep 17 00:00:00 2001 From: Riteo Siuga Date: Fri, 20 Sep 2024 01:50:31 +0200 Subject: [PATCH] ColorPicker: ignore TextureRect expand mode during legacy picking The color picker has a "legacy" fallback mode when `FEATURE_SCREEN_CAPTURE` is not supported by the current `DisplayServer`. It works by "freezing" the current view by making a huge `Popup` with a `TextureRect` inside covering the screen. Before this patch, said `TextureRect` could get cut off if its buffer was nominally bigger than the parent popup, such as when the `canvas_items` content scale mode is active. This is because the default TextureRect scaling logic only allows expanding the texture up. `EXPAND_IGNORE_SIZE` fixes that by allowing the texture to logically "shrink", filling the whole screen independently of the actual buffer size. Special thanks to Federico Fausto Santoro for helping with the diagnosis :D Co-Authored-By: Federico Fausto Santoro --- scene/gui/color_picker.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index c92dcbc153a4..07157143a25c 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -1556,6 +1556,7 @@ void ColorPicker::_pick_button_pressed_legacy() { picker_texture_rect = memnew(TextureRect); picker_texture_rect->set_anchors_preset(Control::PRESET_FULL_RECT); + picker_texture_rect->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE); picker_window->add_child(picker_texture_rect); picker_texture_rect->set_default_cursor_shape(CURSOR_POINTING_HAND); picker_texture_rect->connect(SceneStringName(gui_input), callable_mp(this, &ColorPicker::_picker_texture_input));