1
0
mirror of synced 2025-01-11 05:42:15 +01:00

fix: Better icon text input width calculation

This commit is contained in:
WerWolv 2024-12-23 23:16:35 +01:00
parent 5f2c07f2d8
commit 382599dcf6
2 changed files with 4 additions and 2 deletions

View File

@ -981,7 +981,9 @@ namespace ImGuiExt {
SetCursorPosX(GetCursorPosX() + frame_size.x);
bool value_changed = InputTextEx(label, nullptr, buffer.data(), buffer.size() + 1, ImVec2(CalcItemWidth() - icon_frame_size.x, label_size.y + style.FramePadding.y * 2.0F), ImGuiInputTextFlags_CallbackResize | flags, UpdateStringSizeCallback, &buffer);
float width_adjustment = window->DC.ItemWidth < 0 ? 0 : icon_frame_size.x;
bool value_changed = InputTextEx(label, hint, buffer.data(), buffer.size() + 1, ImVec2(CalcItemWidth() - width_adjustment, label_size.y + style.FramePadding.y * 2.0F), ImGuiInputTextFlags_CallbackResize | flags, UpdateStringSizeCallback, &buffer);
if (value_changed)
MarkItemEdited(GImGui->LastItemData.ID);

View File

@ -1242,7 +1242,7 @@ namespace hex::ui {
this->resetEditing();
}
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - (ImGui::GetTextLineHeightWithSpacing() * 9.4F));
ImGui::PushItemWidth(-(ImGui::GetTextLineHeightWithSpacing() * 8));
if (ImGuiExt::InputTextIcon("##Search", ICON_VS_FILTER, m_filterText)) {
m_filter = parseRValueFilter(m_filterText).value_or(Filter{ });
updateFilter();