summaryrefslogtreecommitdiffstats
path: root/scene/gui/color_picker.cpp
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2019-04-22 22:28:38 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2019-04-29 13:07:47 -0300
commitb8e09f98c421c68816be9d58d528746efce91cb6 (patch)
tree8d57f188853b21c649fdab4060daa41cd88f10f1 /scene/gui/color_picker.cpp
parentf5cc29f9f3536d965917161103c0ae12f2e70358 (diff)
downloadredot-engine-b8e09f98c421c68816be9d58d528746efce91cb6.tar.gz
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) {