A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: make footnotes consider orientation for gutters (#1665)

## Summary

* **What is the goal of this PR?**
Noticed that the footnotes selection screen does not add proper margins
to accommodate screen orientation

* **What changes are included?**
Copied some code over from `EpubReaderChapterSelectionActivity` to
calculate the proper margins in `CW` and `Inverted` orientation

| Before | After |
|--------|--------|
| <img width="578" height="435" alt="image"
src="https://github.com/user-attachments/assets/0518a0c6-13d2-48a1-9283-90c83861e4c2"
/> | <img width="578" height="435" alt="image"
src="https://github.com/user-attachments/assets/ac34365c-72d0-4f07-85a6-17e966b28909"
/> |
| <img width="328" height="435" alt="image"
src="https://github.com/user-attachments/assets/0614f19b-1000-4efe-8ef9-b533d2763a53"
/> | <img width="328" height="435" alt="image"
src="https://github.com/user-attachments/assets/ce9add2f-88e8-4032-a59c-efb55f366604"
/> |

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_

---------

Co-authored-by: Jan Ivanov <jan.ivanov@sirma.com>

authored by

Jan Ivanov
Jan Ivanov
and committed by
GitHub
3b12c083 c4f5c8e9

+22 -6
+22 -6
src/activities/reader/EpubReaderFootnotesActivity.cpp
··· 52 52 void EpubReaderFootnotesActivity::render(RenderLock&&) { 53 53 renderer.clearScreen(); 54 54 55 - renderer.drawCenteredText(UI_12_FONT_ID, 15, tr(STR_FOOTNOTES), true, EpdFontFamily::BOLD); 55 + const auto pageWidth = renderer.getScreenWidth(); 56 + const auto orientation = renderer.getOrientation(); 57 + // Landscape orientation: reserve a horizontal gutter for button hints. 58 + const bool isLandscapeCw = orientation == GfxRenderer::Orientation::LandscapeClockwise; 59 + const bool isLandscapeCcw = orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; 60 + // Inverted portrait: reserve vertical space for hints at the top. 61 + const bool isPortraitInverted = orientation == GfxRenderer::Orientation::PortraitInverted; 62 + const int hintGutterWidth = (isLandscapeCw || isLandscapeCcw) ? 30 : 0; 63 + // Landscape CW places hints on the left edge; CCW keeps them on the right. 64 + const int contentX = isLandscapeCw ? hintGutterWidth : 0; 65 + const int contentWidth = pageWidth - hintGutterWidth; 66 + const int hintGutterHeight = isPortraitInverted ? 50 : 0; 67 + const int contentY = hintGutterHeight; 68 + 69 + // Manual centering to honor content gutters. 70 + const int titleX = 71 + contentX + (contentWidth - renderer.getTextWidth(UI_12_FONT_ID, tr(STR_FOOTNOTES), EpdFontFamily::BOLD)) / 2; 72 + renderer.drawText(UI_12_FONT_ID, titleX, 15 + contentY, tr(STR_FOOTNOTES), true, EpdFontFamily::BOLD); 56 73 57 74 if (footnotes.empty()) { 58 - renderer.drawCenteredText(UI_10_FONT_ID, 90, tr(STR_NO_FOOTNOTES)); 75 + renderer.drawCenteredText(UI_10_FONT_ID, 90 + contentY, tr(STR_NO_FOOTNOTES)); 59 76 const auto labels = mappedInput.mapLabels(tr(STR_BACK), "", "", ""); 60 77 GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); 61 78 renderer.displayBuffer(); 62 79 return; 63 80 } 64 81 65 - constexpr int startY = 50; 66 82 constexpr int lineHeight = 36; 67 83 const int screenWidth = renderer.getScreenWidth(); 68 - constexpr int marginLeft = 20; 84 + const int marginLeft = contentX + 20; 69 85 70 - const int visibleCount = std::max(1, (renderer.getScreenHeight() - startY) / lineHeight); 86 + const int visibleCount = std::max(1, (renderer.getScreenHeight() - contentY) / lineHeight); 71 87 if (selectedIndex < scrollOffset) scrollOffset = selectedIndex; 72 88 if (selectedIndex >= scrollOffset + visibleCount) scrollOffset = selectedIndex - visibleCount + 1; 73 89 74 90 for (int i = scrollOffset; i < static_cast<int>(footnotes.size()) && i < scrollOffset + visibleCount; i++) { 75 - const int y = startY + (i - scrollOffset) * lineHeight; 91 + const int y = 60 + contentY + (i - scrollOffset) * lineHeight; 76 92 const bool isSelected = (i == selectedIndex); 77 93 78 94 if (isSelected) {