Skip to content

Commit

Permalink
Merge pull request #41640 from EricEzaM/PR/popup-menu-rework-scroll-c…
Browse files Browse the repository at this point in the history
…ontainer

PopupMenu rework and enhancements.
  • Loading branch information
akien-mga authored Sep 1, 2020
2 parents ac30466 + 73c7fb2 commit 0afabf6
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 169 deletions.
22 changes: 22 additions & 0 deletions scene/gui/popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,28 @@ Rect2i Popup::_popup_adjust_rect() const {
current.position.y = parent.position.y;
}

if (current.size.y > parent.size.y) {
current.size.y = parent.size.y;
}

if (current.size.x > parent.size.x) {
current.size.x = parent.size.x;
}

// Early out if max size not set.
Size2i max_size = get_max_size();
if (max_size <= Size2()) {
return current;
}

if (current.size.x > max_size.x) {
current.size.x = max_size.x;
}

if (current.size.y > max_size.y) {
current.size.y = max_size.y;
}

return current;
}

Expand Down
Loading

0 comments on commit 0afabf6

Please sign in to comment.