mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Fix popup shadows misbehaving with content_scale_factor
This commit is contained in:
parent
261e7d32d3
commit
a32d3663c4
2 changed files with 28 additions and 12 deletions
|
|
@ -247,8 +247,14 @@ void PopupPanel::_input_from_window(const Ref<InputEvent> &p_event) {
|
|||
|
||||
Ref<InputEventMouseButton> b = p_event;
|
||||
// Hide it if the shadows have been clicked.
|
||||
if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::LEFT && !panel->get_global_rect().has_point(b->get_position())) {
|
||||
_close_pressed();
|
||||
if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::LEFT) {
|
||||
Rect2 panel_area = panel->get_global_rect();
|
||||
float win_scale = get_content_scale_factor();
|
||||
panel_area.position *= win_scale;
|
||||
panel_area.size *= win_scale;
|
||||
if (!panel_area.has_point(b->get_position())) {
|
||||
_close_pressed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WARN_PRINT_ONCE("PopupPanel has received an invalid InputEvent. Consider filtering out invalid events.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue