Fixed IsItemHovered() behaving differently on Combo() (pointed out by #145)

This commit is contained in:
ocornut 2015-02-25 12:28:28 +00:00
parent 3220471237
commit 8bcf2f25f2

View File

@ -5665,6 +5665,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
edit_state.InputCursorScreenPos = cursor_pos; edit_state.InputCursorScreenPos = cursor_pos;
} }
if (text_size.x > 0)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0) if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
@ -5807,12 +5808,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
RenderTextClipped(frame_bb.Min + style.FramePadding, item_text, NULL, NULL, value_bb.Max); RenderTextClipped(frame_bb.Min + style.FramePadding, item_text, NULL, NULL, value_bb.Max);
} }
// Empty text doesn't add padding
if (text_size.x > 0) if (text_size.x > 0)
{ RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
}
ImGui::PushID((int)id); ImGui::PushID((int)id);
bool menu_toggled = false; bool menu_toggled = false;