Fixed ListOverlay.cpp to respect screen bounds.

This commit is contained in:
casey langen 2016-11-07 07:06:12 -08:00
parent 4e3a23eef9
commit 2a1431b9c6

View File

@ -143,10 +143,14 @@ void ListOverlay::RecalculateSize() {
if (this->adapter) {
this->height = std::min(
(int) MAX_HEIGHT,
(int) MAX_HEIGHT,
(int) (4 + this->adapter->GetEntryCount()));
}
/* constrain to app bounds */
this->height = std::max(0, std::min(Screen::GetHeight() - 4, this->height));
this->width = std::max(0, std::min(Screen::GetWidth(), this->width));
this->y = VERTICAL_PADDING;
this->x = (Screen::GetWidth() / 2) - (this->width / 2);
}