Fix contentRect for X3

This commit is contained in:
jpirnay
2026-04-14 20:49:52 +02:00
parent 2565042e1f
commit a57fc5b5fd
2 changed files with 27 additions and 5 deletions
+25 -4
View File
@@ -2,6 +2,7 @@
#include <FsHelpers.h>
#include <GfxRenderer.h>
#include <HalGPIO.h>
#include <I18n.h>
#include <Logging.h>
@@ -77,19 +78,39 @@ Rect UITheme::getContentRect(const GfxRenderer& renderer, bool hasBottomHints, b
switch (renderer.getOrientation()) {
case GfxRenderer::Portrait:
bottom = bh;
right = sw;
if (gpio.deviceIsX3() && hasSideHints) {
left = sw;
right = sw;
} else {
right = sw;
}
break;
case GfxRenderer::PortraitInverted:
top = bh;
left = sw;
if (gpio.deviceIsX3() && hasSideHints) {
left = sw;
right = sw;
} else {
left = sw;
}
break;
case GfxRenderer::LandscapeClockwise:
left = bh;
bottom = sw;
if (gpio.deviceIsX3() && hasSideHints) {
top = sw;
bottom = sw;
} else {
bottom = sw;
}
break;
case GfxRenderer::LandscapeCounterClockwise:
right = bh;
top = sw;
if (gpio.deviceIsX3() && hasSideHints) {
top = sw;
bottom = sw;
} else {
top = sw;
}
break;
}
+2 -1
View File
@@ -55,7 +55,8 @@ class UITheme {
static std::function<bool(int)> makeSelectablePredicate(int total, std::function<std::string(int)> titleGetter);
// Returns the drawable content Rect accounting for screen orientation and visible button hints.
// Bottom hints occupy the physical bottom edge; side hints occupy the physical right edge.
// Bottom hints occupy the physical bottom edge.
// Side hints occupy the physical right edge on X4, and both physical sides on X3.
// The mapping to logical edges is orientation-dependent.
static Rect getContentRect(const GfxRenderer& renderer, bool hasBottomHints, bool hasSideHints);
static std::string getCoverThumbPath(std::string coverBmpPath, int coverHeight);