summaryrefslogtreecommitdiffstats
path: root/scene/gui/color_picker.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-30 10:15:02 +0200
committerGitHub <noreply@github.com>2019-04-30 10:15:02 +0200
commitd0e628fa55da50bd4841f1865b47bb6b283fb886 (patch)
tree4b9f6670bce19d3a7bb0998151b34c3131930217 /scene/gui/color_picker.cpp
parentd647f7ce71dc54dcc77a9e3591ba904ffa9ab1e2 (diff)
parentb8e09f98c421c68816be9d58d528746efce91cb6 (diff)
downloadredot-engine-d0e628fa55da50bd4841f1865b47bb6b283fb886.tar.gz
Merge pull request #28334 from YeldhamDev/popup_buttons_scale
Make buttons that trigger popups have the same scale
Diffstat (limited to 'scene/gui/color_picker.cpp')
-rw-r--r--scene/gui/color_picker.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index accf8aa7c2..d8b2cfb5b9 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -758,23 +758,27 @@ void ColorPickerButton::_modal_closed() {
void ColorPickerButton::pressed() {
_update_picker();
- popup->set_position(get_global_position() - picker->get_combined_minimum_size());
+ popup->set_position(get_global_position() - picker->get_combined_minimum_size() * get_global_transform().get_scale());
+ popup->set_scale(get_global_transform().get_scale());
popup->popup();
picker->set_focus_on_line_edit();
}
void ColorPickerButton::_notification(int p_what) {
- if (p_what == NOTIFICATION_DRAW) {
+ switch (p_what) {
+ case NOTIFICATION_DRAW: {
- Ref<StyleBox> normal = get_stylebox("normal");
- Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
- draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
- draw_rect(r, color);
- }
+ Ref<StyleBox> normal = get_stylebox("normal");
+ Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
+ draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
+ draw_rect(r, color);
+ } break;
+ case MainLoop::NOTIFICATION_WM_QUIT_REQUEST: {
- if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST && popup) {
- popup->hide();
+ if (popup)
+ popup->hide();
+ } break;
}
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {