mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Wrapped text: fixed incorrect testing for negative wrap coordinates, they are perfectly legal. (#706)
This commit is contained in:
parent
92bff4c8d7
commit
4621b357c1
@ -1946,8 +1946,7 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
|
|||||||
else if (wrap_pos_x > 0.0f)
|
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
|
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 ImMax(wrap_pos_x - pos.x, 1.0f);
|
||||||
return wrap_width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -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);
|
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;
|
ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset);
|
||||||
text_pos.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