fix: Item tooltips being sized incorrectly
This commit is contained in:
parent
95f71bcb10
commit
1eadb77722
@ -575,16 +575,23 @@ namespace ImGuiExt {
|
|||||||
if (!std::string_view(text).empty()) {
|
if (!std::string_view(text).empty()) {
|
||||||
const auto textWidth = CalcTextSize(text).x;
|
const auto textWidth = CalcTextSize(text).x;
|
||||||
|
|
||||||
auto width = 150 * hex::ImHexApi::System::getGlobalScale();
|
const auto maxWidth = 300 * hex::ImHexApi::System::getGlobalScale();
|
||||||
if (textWidth < width)
|
const bool wrapping = textWidth > maxWidth;
|
||||||
width = textWidth;
|
|
||||||
|
if (wrapping)
|
||||||
|
ImGui::SetNextWindowSizeConstraints(ImVec2(maxWidth, 0), ImVec2(maxWidth, FLT_MAX));
|
||||||
|
else
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(textWidth + GetStyle().WindowPadding.x * 2, 0));
|
||||||
|
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(width, 0), ImVec2(width * 2, FLT_MAX));
|
|
||||||
if (BeginTooltip()) {
|
if (BeginTooltip()) {
|
||||||
if (isSeparator)
|
if (isSeparator)
|
||||||
SeparatorText(text);
|
SeparatorText(text);
|
||||||
else
|
else {
|
||||||
|
if (wrapping)
|
||||||
TextFormattedWrapped("{}", text);
|
TextFormattedWrapped("{}", text);
|
||||||
|
else
|
||||||
|
TextFormatted("{}", text);
|
||||||
|
}
|
||||||
|
|
||||||
EndTooltip();
|
EndTooltip();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user