Make Color Picker, Menu Button, Option Button consider camera position scale for popup position.

This commit is contained in:
menip 2021-08-30 08:42:33 -07:00
parent 4d08a737fb
commit 4f4c9a5f57
3 changed files with 8 additions and 6 deletions

View file

@ -1308,6 +1308,8 @@ void ColorPickerButton::_modal_closed() {
void ColorPickerButton::pressed() {
_update_picker();
Size2 size = get_size() * get_viewport()->get_canvas_transform().get_scale();
popup->set_as_minsize();
picker->_update_presets();
@ -1319,13 +1321,13 @@ void ColorPickerButton::pressed() {
if (i > 1) {
cp_rect.position.y = get_screen_position().y - cp_rect.size.y;
} else {
cp_rect.position.y = get_screen_position().y + get_size().height;
cp_rect.position.y = get_screen_position().y + size.height;
}
if (i & 1) {
cp_rect.position.x = get_screen_position().x;
} else {
cp_rect.position.x = get_screen_position().x - MAX(0, (cp_rect.size.x - get_size().x));
cp_rect.position.x = get_screen_position().x - MAX(0, (cp_rect.size.x - size.x));
}
if (usable_rect.encloses(cp_rect)) {