TextUnformatted(): minor tweak

This commit is contained in:
omar 2017-10-05 11:03:38 -07:00
parent a0d724b450
commit 726dcf0dd2

View File

@ -5552,6 +5552,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
if (text_end == NULL)
text_end = text + strlen(text); // FIXME-OPT
const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset);
const float wrap_pos_x = window->DC.TextWrapPos;
const bool wrap_enabled = wrap_pos_x >= 0.0f;
if (text_end - text > 2000 && !wrap_enabled)
@ -5562,7 +5563,6 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
// We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
const char* line = text;
const float line_height = GetTextLineHeight();
const ImVec2 text_pos = window->DC.CursorPos + ImVec2(0.0f, window->DC.CurrentLineTextBaseOffset);
const ImRect clip_rect = window->ClipRect;
ImVec2 text_size(0,0);
@ -5636,7 +5636,6 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);
// Account of baseline offset
ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset);
ImRect bb(text_pos, text_pos + text_size);
ItemSize(text_size);
if (!ItemAdd(bb, NULL))