fix: prevent BookInfo content from overlapping header on scroll
Draw header after content with a white fill over the header zone, so scrolled cover images and text slide behind the header instead of rendering on top of it. Removed incorrect maxHeight clamping that caused the cover to shrink rather than scroll. Made-with: Cursor
This commit is contained in:
@@ -255,19 +255,16 @@ void BookInfoActivity::render(RenderLock&&) {
|
||||
const int contentTop = metrics.topPadding + metrics.headerHeight + metrics.verticalSpacing;
|
||||
const int contentBottom = pageH - metrics.buttonHintsHeight - metrics.verticalSpacing;
|
||||
|
||||
GUI.drawHeader(renderer, Rect(0, metrics.topPadding, pageW, metrics.headerHeight), tr(STR_BOOK_INFO));
|
||||
|
||||
int y = contentTop - scrollOffset;
|
||||
|
||||
if (!coverBmpPath.empty() && coverDisplayHeight > 0) {
|
||||
if (y + coverDisplayHeight > contentTop && y < contentBottom) {
|
||||
if (y + coverDisplayHeight > 0 && y < contentBottom) {
|
||||
FsFile file;
|
||||
if (Storage.openFileForRead("BIF", coverBmpPath, file)) {
|
||||
Bitmap bitmap(file);
|
||||
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
||||
const int coverX = (pageW - coverDisplayWidth) / 2;
|
||||
renderer.drawBitmap1Bit(bitmap, coverX, y, coverDisplayWidth,
|
||||
std::min(coverDisplayHeight, contentBottom - y));
|
||||
renderer.drawBitmap1Bit(bitmap, coverX, y, coverDisplayWidth, coverDisplayHeight);
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
@@ -296,6 +293,9 @@ void BookInfoActivity::render(RenderLock&&) {
|
||||
y += SECTION_GAP;
|
||||
}
|
||||
|
||||
renderer.fillRect(0, 0, pageW, contentTop, false);
|
||||
GUI.drawHeader(renderer, Rect(0, metrics.topPadding, pageW, metrics.headerHeight), tr(STR_BOOK_INFO));
|
||||
|
||||
const bool canScrollDown = scrollOffset + pageH < contentHeight;
|
||||
const bool canScrollUp = scrollOffset > 0;
|
||||
const char* downHint = canScrollDown ? tr(STR_DIR_DOWN) : "";
|
||||
|
||||
Reference in New Issue
Block a user