Added overlooked test for label_size.x>0 before calling RenderText for label in a few instances (#487)

This commit is contained in:
ocornut 2016-01-16 12:01:18 +00:00
parent 31fe006c85
commit fc66365805

View File

@ -5172,6 +5172,7 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
const char* value_text_begin = &g.TempBuffer[0]; const char* value_text_begin = &g.TempBuffer[0];
const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter); RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter);
if (label_size.x > 0.0f)
RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
} }
@ -6757,6 +6758,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
if (overlay_text) if (overlay_text)
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center); RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center);
if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
} }
@ -6874,6 +6876,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
if (g.LogEnabled) if (g.LogEnabled)
LogRenderedText(text_bb.GetTL(), *v ? "[x]" : "[ ]"); LogRenderedText(text_bb.GetTL(), *v ? "[x]" : "[ ]");
if (label_size.x > 0.0f)
RenderText(text_bb.GetTL(), label); RenderText(text_bb.GetTL(), label);
return pressed; return pressed;
@ -6941,6 +6944,7 @@ bool ImGui::RadioButton(const char* label, bool active)
if (g.LogEnabled) if (g.LogEnabled)
LogRenderedText(text_bb.GetTL(), active ? "(x)" : "( )"); LogRenderedText(text_bb.GetTL(), active ? "(x)" : "( )");
if (label_size.x > 0.0f)
RenderText(text_bb.GetTL(), label); RenderText(text_bb.GetTL(), label);
return pressed; return pressed;