fix(keys): stop the key-export warning text clipping; scale field heights with font
From a screenshot at a non-default font scale: the red WARNING box clipped its text
("...balance, but" cut off) because it used a fixed 80px child height while the text inside
scales with the font. Make the warning box auto-size to its content (ImGuiChildFlags_AutoResizeY)
so it never clips at any scale, and scale the address / key read-only field heights by
Layout::dpiScale() for the same reason. Complements the card-width scaling fix.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -75,7 +75,10 @@ void KeyExportDialog::render(App* app)
|
||||
|
||||
// Warning section with colored background
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.6f, 0.2f, 0.2f, 0.3f));
|
||||
ImGui::BeginChild("WarningBox", ImVec2(-1, warningBox.height > 0 ? warningBox.height : 80), true);
|
||||
// Auto-size the warning box to its (wrapping, font-scaled) text so it never clips it.
|
||||
(void)warningBox;
|
||||
ImGui::BeginChild("WarningBox", ImVec2(-1, 0),
|
||||
ImGuiChildFlags_AutoResizeY | ImGuiChildFlags_Borders);
|
||||
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), " %s", TR("warning_upper"));
|
||||
ImGui::Spacing();
|
||||
@@ -104,8 +107,9 @@ void KeyExportDialog::render(App* app)
|
||||
char addr_buf[512];
|
||||
strncpy(addr_buf, s_address.c_str(), sizeof(addr_buf) - 1);
|
||||
addr_buf[sizeof(addr_buf) - 1] = '\0';
|
||||
ImGui::InputTextMultiline("##Address", addr_buf, sizeof(addr_buf),
|
||||
ImVec2(-1, addrInput.height > 0 ? addrInput.height : 60), ImGuiInputTextFlags_ReadOnly);
|
||||
ImGui::InputTextMultiline("##Address", addr_buf, sizeof(addr_buf),
|
||||
ImVec2(-1, (addrInput.height > 0 ? addrInput.height : 60) * Layout::dpiScale()),
|
||||
ImGuiInputTextFlags_ReadOnly);
|
||||
} else {
|
||||
char addr_buf[128];
|
||||
strncpy(addr_buf, s_address.c_str(), sizeof(addr_buf) - 1);
|
||||
@@ -201,7 +205,7 @@ void KeyExportDialog::render(App* app)
|
||||
strncpy(key_buf, s_key.c_str(), sizeof(key_buf) - 1);
|
||||
key_buf[sizeof(key_buf) - 1] = '\0';
|
||||
ImGui::InputTextMultiline("##Key", key_buf, sizeof(key_buf),
|
||||
ImVec2(-1, keyDisplay.height > 0 ? keyDisplay.height : 80), ImGuiInputTextFlags_ReadOnly);
|
||||
ImVec2(-1, (keyDisplay.height > 0 ? keyDisplay.height : 80) * Layout::dpiScale()), ImGuiInputTextFlags_ReadOnly);
|
||||
} else {
|
||||
// Show masked
|
||||
std::string masked(s_key.length(), '*');
|
||||
@@ -209,7 +213,7 @@ void KeyExportDialog::render(App* app)
|
||||
strncpy(masked_buf, masked.c_str(), sizeof(masked_buf) - 1);
|
||||
masked_buf[sizeof(masked_buf) - 1] = '\0';
|
||||
ImGui::InputTextMultiline("##Key", masked_buf, sizeof(masked_buf),
|
||||
ImVec2(-1, keyDisplay.height > 0 ? keyDisplay.height : 80), ImGuiInputTextFlags_ReadOnly);
|
||||
ImVec2(-1, (keyDisplay.height > 0 ? keyDisplay.height : 80) * Layout::dpiScale()), ImGuiInputTextFlags_ReadOnly);
|
||||
}
|
||||
|
||||
// Action row: Show/Hide · Copy · QR
|
||||
|
||||
Reference in New Issue
Block a user