mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-29 14:56:36 +00:00
Fixed default proportional item width lagging by one frame on resize + miscellaneous minor tweaks.
This commit is contained in:
parent
83d97d4a9b
commit
7241dc61d4
@ -48,6 +48,7 @@ Other Changes:
|
|||||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||||
|
|
||||||
- Settings: Fixed saving an empty .ini file if CreateContext/DestroyContext are called without a single call to NewFrame(). (#1741)
|
- Settings: Fixed saving an empty .ini file if CreateContext/DestroyContext are called without a single call to NewFrame(). (#1741)
|
||||||
|
- Window: Fixed default proportional item width lagging by one frame on resize.
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
22
imgui.cpp
22
imgui.cpp
@ -4157,13 +4157,9 @@ void ImGui::LogText(const char* fmt, ...)
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
if (g.LogFile)
|
if (g.LogFile)
|
||||||
{
|
|
||||||
vfprintf(g.LogFile, fmt, args);
|
vfprintf(g.LogFile, fmt, args);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
g.LogClipboard->appendfv(fmt, args);
|
g.LogClipboard->appendfv(fmt, args);
|
||||||
}
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4239,8 +4235,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
|
|||||||
text_display_end = text_end;
|
text_display_end = text_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int text_len = (int)(text_display_end - text);
|
if (text != text_display_end)
|
||||||
if (text_len > 0)
|
|
||||||
{
|
{
|
||||||
window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);
|
window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);
|
||||||
if (g.LogEnabled)
|
if (g.LogEnabled)
|
||||||
@ -4256,8 +4251,7 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
|
|||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text + strlen(text); // FIXME-OPT
|
text_end = text + strlen(text); // FIXME-OPT
|
||||||
|
|
||||||
const int text_len = (int)(text_end - text);
|
if (text != text_end)
|
||||||
if (text_len > 0)
|
|
||||||
{
|
{
|
||||||
window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);
|
window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);
|
||||||
if (g.LogEnabled)
|
if (g.LogEnabled)
|
||||||
@ -5935,12 +5929,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
}
|
}
|
||||||
window->Pos = ImFloor(window->PosFloat);
|
window->Pos = ImFloor(window->PosFloat);
|
||||||
|
|
||||||
// Default item width. Make it proportional to window size if window manually resizes
|
|
||||||
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
|
||||||
window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f);
|
|
||||||
else
|
|
||||||
window->ItemWidthDefault = (float)(int)(g.FontSize * 16.0f);
|
|
||||||
|
|
||||||
// Prepare for focus requests
|
// Prepare for focus requests
|
||||||
window->FocusIdxAllRequestCurrent = (window->FocusIdxAllRequestNext == INT_MAX || window->FocusIdxAllCounter == -1) ? INT_MAX : (window->FocusIdxAllRequestNext + (window->FocusIdxAllCounter+1)) % (window->FocusIdxAllCounter+1);
|
window->FocusIdxAllRequestCurrent = (window->FocusIdxAllRequestNext == INT_MAX || window->FocusIdxAllCounter == -1) ? INT_MAX : (window->FocusIdxAllRequestNext + (window->FocusIdxAllCounter+1)) % (window->FocusIdxAllCounter+1);
|
||||||
window->FocusIdxTabRequestCurrent = (window->FocusIdxTabRequestNext == INT_MAX || window->FocusIdxTabCounter == -1) ? INT_MAX : (window->FocusIdxTabRequestNext + (window->FocusIdxTabCounter+1)) % (window->FocusIdxTabCounter+1);
|
window->FocusIdxTabRequestCurrent = (window->FocusIdxTabRequestNext == INT_MAX || window->FocusIdxTabCounter == -1) ? INT_MAX : (window->FocusIdxTabRequestNext + (window->FocusIdxTabCounter+1)) % (window->FocusIdxTabCounter+1);
|
||||||
@ -5965,6 +5953,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
if (!window->Collapsed)
|
if (!window->Collapsed)
|
||||||
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
||||||
|
|
||||||
|
// Default item width. Make it proportional to window size if window manually resizes
|
||||||
|
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
|
window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f);
|
||||||
|
else
|
||||||
|
window->ItemWidthDefault = (float)(int)(g.FontSize * 16.0f);
|
||||||
|
|
||||||
// DRAWING
|
// DRAWING
|
||||||
|
|
||||||
// Setup draw list and outer clipping rectangle
|
// Setup draw list and outer clipping rectangle
|
||||||
|
Loading…
Reference in New Issue
Block a user