Refactor ui content rect
This commit is contained in:
@@ -105,19 +105,20 @@ void ButtonRemapActivity::render(RenderLock&&) {
|
||||
};
|
||||
|
||||
const auto& metrics = UITheme::getInstance().getMetrics();
|
||||
const auto pageWidth = renderer.getScreenWidth();
|
||||
const auto pageHeight = renderer.getScreenHeight();
|
||||
const Rect contentRect = UITheme::getContentRect(renderer, true, false);
|
||||
|
||||
renderer.clearScreen();
|
||||
|
||||
GUI.drawHeader(renderer, Rect{0, metrics.topPadding, pageWidth, metrics.headerHeight}, tr(STR_REMAP_FRONT_BUTTONS));
|
||||
GUI.drawSubHeader(renderer, Rect{0, metrics.topPadding + metrics.headerHeight, pageWidth, metrics.tabBarHeight},
|
||||
tr(STR_REMAP_PROMPT));
|
||||
GUI.drawHeader(renderer, Rect{contentRect.x, metrics.topPadding, contentRect.width, metrics.headerHeight},
|
||||
tr(STR_REMAP_FRONT_BUTTONS));
|
||||
GUI.drawSubHeader(
|
||||
renderer, Rect{contentRect.x, metrics.topPadding + metrics.headerHeight, contentRect.width, metrics.tabBarHeight},
|
||||
tr(STR_REMAP_PROMPT));
|
||||
|
||||
int topOffset = metrics.topPadding + metrics.headerHeight + metrics.tabBarHeight + metrics.verticalSpacing;
|
||||
int contentHeight = pageHeight - topOffset - metrics.buttonHintsHeight - metrics.verticalSpacing;
|
||||
int contentHeight = contentRect.height - topOffset - metrics.verticalSpacing;
|
||||
GUI.drawList(
|
||||
renderer, Rect{0, topOffset, pageWidth, contentHeight}, kRoleCount, currentStep,
|
||||
renderer, Rect{contentRect.x, topOffset, contentRect.width, contentHeight}, kRoleCount, currentStep,
|
||||
[&](int index) { return getRoleName(static_cast<uint8_t>(index)); }, nullptr, nullptr,
|
||||
[&](int index) {
|
||||
uint8_t assignedButton = tempMapping[static_cast<uint8_t>(index)];
|
||||
@@ -128,16 +129,19 @@ void ButtonRemapActivity::render(RenderLock&&) {
|
||||
// Temporary warning banner for duplicates.
|
||||
if (!errorMessage.empty()) {
|
||||
GUI.drawHelpText(renderer,
|
||||
Rect{0, pageHeight - metrics.buttonHintsHeight - metrics.contentSidePadding - 15, pageWidth, 20},
|
||||
Rect{contentRect.x, contentRect.y + contentRect.height - metrics.contentSidePadding - 15,
|
||||
contentRect.width, 20},
|
||||
errorMessage.c_str());
|
||||
}
|
||||
|
||||
// Provide side button actions at the bottom of the screen (split across two lines).
|
||||
GUI.drawHelpText(
|
||||
renderer,
|
||||
Rect{contentRect.x, topOffset + 4 * metrics.listRowHeight + 4 * metrics.verticalSpacing, contentRect.width, 20},
|
||||
tr(STR_REMAP_RESET_HINT));
|
||||
GUI.drawHelpText(renderer,
|
||||
Rect{0, topOffset + 4 * metrics.listRowHeight + 4 * metrics.verticalSpacing, pageWidth, 20},
|
||||
tr(STR_REMAP_RESET_HINT));
|
||||
GUI.drawHelpText(renderer,
|
||||
Rect{0, topOffset + 4 * metrics.listRowHeight + 5 * metrics.verticalSpacing + 20, pageWidth, 20},
|
||||
Rect{contentRect.x, topOffset + 4 * metrics.listRowHeight + 5 * metrics.verticalSpacing + 20,
|
||||
contentRect.width, 20},
|
||||
tr(STR_REMAP_CANCEL_HINT));
|
||||
|
||||
// Live preview of logical labels under front buttons.
|
||||
|
||||
Reference in New Issue
Block a user