Compare commits

..

No commits in common. "2b6927f0834b5405735cdb567ecc5efc3744d30f" and "17c20db930eb242fa2aebdb6a49dd2fba9414541" have entirely different histories.

2 changed files with 5 additions and 4 deletions

View File

@ -255,8 +255,9 @@ void EpubReaderActivity::jumpToPercent(int percent) {
// Convert percent into a byte-like absolute position across the spine sizes.
// Use an overflow-safe computation: (bookSize / 100) * percent + (bookSize % 100) * percent / 100
size_t targetSize =
(bookSize / 100) * static_cast<size_t>(percent) + (bookSize % 100) * static_cast<size_t>(percent) / 100;
if (percent >= 100) {
(bookSize / 100) * static_cast<size_t>(percent) +
(bookSize % 100) * static_cast<size_t>(percent) / 100;
if (percent >= 100 && bookSize > 0) {
// Ensure the final percent lands inside the last spine item.
targetSize = bookSize - 1;
}

View File

@ -106,14 +106,14 @@ void EpubReaderPercentSelectionActivity::renderScreen() {
renderer.drawCenteredText(UI_12_FONT_ID, 15, "Go to Position", true, EpdFontFamily::BOLD);
const std::string percentText = std::to_string(percent) + "%";
renderer.drawCenteredText(UI_12_FONT_ID, 90, percentText.c_str(), true, EpdFontFamily::BOLD);
renderer.drawCenteredText(UI_12_FONT_ID, 70, percentText.c_str(), true, EpdFontFamily::BOLD);
// Draw slider track.
const int screenWidth = renderer.getScreenWidth();
constexpr int barWidth = 360;
constexpr int barHeight = 16;
const int barX = (screenWidth - barWidth) / 2;
const int barY = 140;
const int barY = 120;
renderer.drawRect(barX, barY, barWidth, barHeight);