diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index aa8065398..031a2dd18 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -150,21 +150,21 @@ void ComponentList::updateCameraOffset() // Move the camera to scroll. const float totalHeight = getTotalRowHeight(); if (totalHeight > mSize.y()) { - float target = mSelectorBarOffset + getRowHeight(mEntries.at(mCursor).data)/2 - - (mSize.y() / 2); + float target = mSelectorBarOffset + + getRowHeight(mEntries.at(mCursor).data) / 2.0f - (mSize.y() / 2.0f); - // Clamp it. - mCameraOffset = 0; + // Clamp the camera to prevent a fraction of a row from being displayed. + mCameraOffset = 0.0f; unsigned int i = 0; while (mCameraOffset < target && i < mEntries.size()) { mCameraOffset += getRowHeight(mEntries.at(i).data); + if (mCameraOffset > totalHeight - mSize.y()) + break; i++; } if (mCameraOffset < 0) mCameraOffset = 0; - else if (mCameraOffset + mSize.y() > totalHeight) - mCameraOffset = totalHeight - mSize.y(); } else { mCameraOffset = 0; diff --git a/es-core/src/components/MenuComponent.cpp b/es-core/src/components/MenuComponent.cpp index 30fdfbc90..85cce1d5c 100644 --- a/es-core/src/components/MenuComponent.cpp +++ b/es-core/src/components/MenuComponent.cpp @@ -82,12 +82,14 @@ float MenuComponent::getButtonGridHeight() const void MenuComponent::updateSize() { const float maxHeight = Renderer::getScreenHeight() * 0.75f; - float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() + 2; + float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() + + (2 * Renderer::getScreenHeightModifier()); if (height > maxHeight) { height = TITLE_HEIGHT + getButtonGridHeight(); int i = 0; while (i < mList->size()) { - float rowHeight = mList->getRowHeight(i); + // Add the separator height to the row height so that it also gets properly rendered. + float rowHeight = mList->getRowHeight(i) + (1 * Renderer::getScreenHeightModifier()); if (height + rowHeight < maxHeight) height += rowHeight; else