From 941ef993d9d6718dbf0814342ad4d68e819629b1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 12 Feb 2015 19:34:14 +0000 Subject: [PATCH] ImGuITextFilter::Draw() use regular width call. --- imgui.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index b963308b..feb3b599 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1269,14 +1269,11 @@ ImGuiTextFilter::ImGuiTextFilter() void ImGuiTextFilter::Draw(const char* label, float width) { ImGuiWindow* window = GetCurrentWindow(); - if (width < 0.0f) - { - ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); - width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui->Style.ItemSpacing.x*4), 10.0f); - } - ImGui::PushItemWidth(width); + if (width > 0.0f) + ImGui::PushItemWidth(width); ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); - ImGui::PopItemWidth(); + if (width > 0.0f) + ImGui::PopItemWidth(); Build(); }