mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
TextUnformatted(): minor tweak
This commit is contained in:
parent
a0d724b450
commit
726dcf0dd2
@ -5552,6 +5552,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
if (text_end == NULL)
|
if (text_end == NULL)
|
||||||
text_end = text + strlen(text); // FIXME-OPT
|
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 float wrap_pos_x = window->DC.TextWrapPos;
|
||||||
const bool wrap_enabled = wrap_pos_x >= 0.0f;
|
const bool wrap_enabled = wrap_pos_x >= 0.0f;
|
||||||
if (text_end - text > 2000 && !wrap_enabled)
|
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.
|
// 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 char* line = text;
|
||||||
const float line_height = GetTextLineHeight();
|
const float line_height = GetTextLineHeight();
|
||||||
const ImVec2 text_pos = window->DC.CursorPos + ImVec2(0.0f, window->DC.CurrentLineTextBaseOffset);
|
|
||||||
const ImRect clip_rect = window->ClipRect;
|
const ImRect clip_rect = window->ClipRect;
|
||||||
ImVec2 text_size(0,0);
|
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);
|
const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);
|
||||||
|
|
||||||
// Account of baseline offset
|
// 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);
|
ImRect bb(text_pos, text_pos + text_size);
|
||||||
ItemSize(text_size);
|
ItemSize(text_size);
|
||||||
if (!ItemAdd(bb, NULL))
|
if (!ItemAdd(bb, NULL))
|
||||||
|
Loading…
Reference in New Issue
Block a user