fix: sidebar nav text overflow for long translations
- Add text scaling for section labels (TOOLS, ADVANCED) in sidebar - Separate explorer_section key from explorer nav label to fix ALL CAPS - Shorten long sidebar translations: es/pt settings, pt overview, ru tools/advanced - Fix explorer translations from ALL CAPS to proper case in all languages
This commit is contained in:
@@ -557,15 +557,21 @@ inline bool RenderSidebar(NavPage& current, float sidebarWidth, float contentHei
|
||||
if (showLabels) {
|
||||
ImFont* olFont = Type().overline();
|
||||
float olFontSz = ScaledFontSize(olFont);
|
||||
float maxSectionW = panelRight - wp.x - sbSectionLabelPadLeft;
|
||||
int si = 0;
|
||||
for (int i = 0; i < (int)NavPage::Count_; ++i) {
|
||||
if (kNavItems[i].section_label && si < nSectionLabels) {
|
||||
float ly = panelTopY + sectionLabelY[si++];
|
||||
const char* sLabel = NavSectionLabel(kNavItems[i]);
|
||||
float drawFsz = olFontSz;
|
||||
ImVec2 sLabelSz = olFont->CalcTextSizeA(drawFsz, 1000.0f, 0.0f, sLabel);
|
||||
if (sLabelSz.x > maxSectionW && maxSectionW > 0)
|
||||
drawFsz *= maxSectionW / sLabelSz.x;
|
||||
ImVec4 olCol = ImGui::ColorConvertU32ToFloat4(OnSurfaceMedium());
|
||||
olCol.w *= expandFrac;
|
||||
dl->AddText(olFont, olFontSz,
|
||||
dl->AddText(olFont, drawFsz,
|
||||
ImVec2(wp.x + sbSectionLabelPadLeft, ly),
|
||||
ImGui::ColorConvertFloat4ToU32(olCol), NavSectionLabel(kNavItems[i]));
|
||||
ImGui::ColorConvertFloat4ToU32(olCol), sLabel);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user