mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the lower point of the current clipping rectangle. Somehow this bug has been there since v1.0! It was hardly noticeable but would affect the scrolling range, which in turn would affect some scrolling request functions when called during the opening frame of a window.
This commit is contained in:
parent
ac4842fa17
commit
622a27506a
@ -63,6 +63,10 @@ Other Changes:
|
|||||||
- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371)
|
- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371)
|
||||||
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
|
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
|
||||||
hard crashes any more, facilitating integration with scripting languages. (#1651)
|
hard crashes any more, facilitating integration with scripting languages. (#1651)
|
||||||
|
- Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the
|
||||||
|
lower point of the current clipping rectangle. Somehow this bug has been there since v1.0!
|
||||||
|
It was hardly noticeable but would affect the scrolling range, which in turn would affect
|
||||||
|
some scrolling request functions when called during the opening frame of a window.
|
||||||
- Plot: Fixed divide-by-zero in PlotLines() when passing a count of 1. (#2387) [@Lectem]
|
- Plot: Fixed divide-by-zero in PlotLines() when passing a count of 1. (#2387) [@Lectem]
|
||||||
- Log/Capture: Fixed extraneous leading carriage return.
|
- Log/Capture: Fixed extraneous leading carriage return.
|
||||||
- Log/Capture: Fixed an issue when empty string on a new line would not emit a carriage return.
|
- Log/Capture: Fixed an issue when empty string on a new line would not emit a carriage return.
|
||||||
|
@ -191,6 +191,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- text wrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (#249)
|
- text wrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (#249)
|
||||||
- text: it's currently impossible to have a window title with "##". perhaps an official workaround would be nice. \ style inhibitor? non-visible ascii code to insert between #?
|
- text: it's currently impossible to have a window title with "##". perhaps an official workaround would be nice. \ style inhibitor? non-visible ascii code to insert between #?
|
||||||
- text: provided a framed text helper, e.g. https://pastebin.com/1Laxy8bT
|
- text: provided a framed text helper, e.g. https://pastebin.com/1Laxy8bT
|
||||||
|
- text: refactor TextUnformatted (or underlying function) to more explicitly request if we need width measurement or not
|
||||||
- text link/url button: underlined. should api expose an ID or use text contents as ID? which colors enum to use?
|
- text link/url button: underlined. should api expose an ID or use text contents as ID? which colors enum to use?
|
||||||
|
|
||||||
- tree node / optimization: avoid formatting when clipped.
|
- tree node / optimization: avoid formatting when clipped.
|
||||||
|
2
imgui.h
2
imgui.h
@ -297,7 +297,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
|
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
|
||||||
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
||||||
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
||||||
IMGUI_API void SetScrollFromPosY(float local_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
|
IMGUI_API void SetScrollFromPosY(float local_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.
|
||||||
|
|
||||||
// Parameters stacks (shared)
|
// Parameters stacks (shared)
|
||||||
IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font
|
IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font
|
||||||
|
@ -159,11 +159,8 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
const ImRect clip_rect = window->ClipRect;
|
const ImRect clip_rect = window->ClipRect;
|
||||||
ImVec2 text_size(0,0);
|
ImVec2 text_size(0,0);
|
||||||
|
|
||||||
if (text_pos.y <= clip_rect.Max.y)
|
|
||||||
{
|
|
||||||
ImVec2 pos = text_pos;
|
|
||||||
|
|
||||||
// Lines to skip (can't skip when logging text)
|
// Lines to skip (can't skip when logging text)
|
||||||
|
ImVec2 pos = text_pos;
|
||||||
if (!g.LogEnabled)
|
if (!g.LogEnabled)
|
||||||
{
|
{
|
||||||
int lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height);
|
int lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height);
|
||||||
@ -215,9 +212,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
}
|
}
|
||||||
pos.y += lines_skipped * line_height;
|
pos.y += lines_skipped * line_height;
|
||||||
}
|
}
|
||||||
|
text_size.y = (pos - text_pos).y;
|
||||||
text_size.y += (pos - text_pos).y;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImRect bb(text_pos, text_pos + text_size);
|
ImRect bb(text_pos, text_pos + text_size);
|
||||||
ItemSize(text_size);
|
ItemSize(text_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user