1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-09-24 19:48:34 +02:00

Wrapped text: fixed incorrect testing for negative wrap coordinates, they are perfectly legal. (#706)

This commit is contained in:
ocornut 2016-06-19 12:50:22 +02:00
parent 92bff4c8d7
commit 4621b357c1

View File

@ -1946,8 +1946,7 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
else if (wrap_pos_x > 0.0f)
wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space
const float wrap_width = wrap_pos_x > 0.0f ? ImMax(wrap_pos_x - pos.x, 0.00001f) : 0.0f;
return wrap_width;
return ImMax(wrap_pos_x - pos.x, 1.0f);
}
//-----------------------------------------------------------------------------
@ -5356,9 +5355,7 @@ 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;
text_pos.y += window->DC.CurrentLineTextBaseOffset;
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))