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,7 +5172,8 @@ 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);
RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); if (label_size.x > 0.0f)
RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
} }
void ImGui::LabelText(const char* label, const char* fmt, ...) void ImGui::LabelText(const char* label, const char* fmt, ...)
@ -6757,7 +6758,8 @@ 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);
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
} }
struct ImGuiPlotArrayGetterData struct ImGuiPlotArrayGetterData
@ -6874,7 +6876,8 @@ 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]" : "[ ]");
RenderText(text_bb.GetTL(), label); if (label_size.x > 0.0f)
RenderText(text_bb.GetTL(), label);
return pressed; return pressed;
} }
@ -6941,7 +6944,8 @@ 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)" : "( )");
RenderText(text_bb.GetTL(), label); if (label_size.x > 0.0f)
RenderText(text_bb.GetTL(), label);
return pressed; return pressed;
} }