Updated ImGui.
This commit is contained in:
parent
9499acce56
commit
b2246455db
16
3rdparty/dear-imgui/imgui.cpp
vendored
16
3rdparty/dear-imgui/imgui.cpp
vendored
@ -3256,6 +3256,9 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
||||
|
||||
// Handle mouse moving window
|
||||
// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing()
|
||||
// FIXME: We don't have strong guarantee that g.MovingWindow stay synched with g.ActiveId == g.MovingWindow->MoveId.
|
||||
// This is currently enforced by the fact that BeginDragDropSource() is setting all g.ActiveIdUsingXXXX flags to inhibit navigation inputs,
|
||||
// but if we should more thoroughly test cases where g.ActiveId or g.MovingWindow gets changed and not the other.
|
||||
void ImGui::UpdateMouseMovingWindowNewFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -5843,19 +5846,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->DC.ParentLayoutType = parent_window ? parent_window->DC.LayoutType : ImGuiLayoutType_Vertical;
|
||||
window->DC.FocusCounterRegular = window->DC.FocusCounterTabStop = -1;
|
||||
|
||||
window->DC.ItemFlags = parent_window ? parent_window->DC.ItemFlags : ImGuiItemFlags_Default_;
|
||||
window->DC.ItemWidth = window->ItemWidthDefault;
|
||||
window->DC.TextWrapPos = -1.0f; // disabled
|
||||
window->DC.ItemFlagsStack.resize(0);
|
||||
window->DC.ItemWidthStack.resize(0);
|
||||
window->DC.TextWrapPosStack.resize(0);
|
||||
window->DC.GroupStack.resize(0);
|
||||
|
||||
if ((flags & ImGuiWindowFlags_ChildWindow) && (window->DC.ItemFlags != parent_window->DC.ItemFlags))
|
||||
{
|
||||
window->DC.ItemFlags = parent_window->DC.ItemFlags;
|
||||
window->DC.ItemFlags = parent_window ? parent_window->DC.ItemFlags : ImGuiItemFlags_Default_;
|
||||
if (parent_window)
|
||||
window->DC.ItemFlagsStack.push_back(window->DC.ItemFlags);
|
||||
}
|
||||
|
||||
if (window->AutoFitFramesX > 0)
|
||||
window->AutoFitFramesX--;
|
||||
@ -9001,6 +9000,11 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
return false;
|
||||
source_parent_id = window->IDStack.back();
|
||||
source_drag_active = IsMouseDragging(mouse_button);
|
||||
|
||||
// Disable navigation and key inputs while dragging
|
||||
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingNavInputMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingKeyInputMask = ~(ImU64)0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
9
3rdparty/dear-imgui/imgui_demo.cpp
vendored
9
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@ -629,7 +629,7 @@ static void ShowDemoWindowWidgets()
|
||||
{
|
||||
ImGui::Text("blah blah");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("button")) {};
|
||||
if (ImGui::SmallButton("button")) {}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
@ -4524,9 +4524,10 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
y = ImGui::GetCursorScreenPos().y;
|
||||
for (int n = 0; n < gradient_steps; n++)
|
||||
{
|
||||
float f = n / (float)gradient_steps;
|
||||
ImU32 col32 = ImGui::GetColorU32(ImVec4(f, f, f, 1.0f));
|
||||
draw_list->AddRectFilled(ImVec2(x + gradient_size.x * (n / (float)gradient_steps), y), ImVec2(x + gradient_size.x * ((n+1) / (float)gradient_steps), y + gradient_size.y), col32);
|
||||
float f0 = n / (float)gradient_steps;
|
||||
float f1 = (n + 1) / (float)gradient_steps;
|
||||
ImU32 col32 = ImGui::GetColorU32(ImVec4(f0, f0, f0, 1.0f));
|
||||
draw_list->AddRectFilled(ImVec2(x + gradient_size.x * f0, y), ImVec2(x + gradient_size.x * f1, y + gradient_size.y), col32);
|
||||
}
|
||||
ImGui::InvisibleButton("##gradient", gradient_size);
|
||||
|
||||
|
6
3rdparty/dear-imgui/imgui_draw.cpp
vendored
6
3rdparty/dear-imgui/imgui_draw.cpp
vendored
@ -617,8 +617,8 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c
|
||||
|
||||
// On AddPolyline() and AddConvexPolyFilled() we intentionally avoid using ImVec2 and superflous function calls to optimize debug/non-inlined builds.
|
||||
// Those macros expects l-values.
|
||||
#define IM_NORMALIZE2F_OVER_ZERO(VX,VY) { float d2 = VX*VX + VY*VY; if (d2 > 0.0f) { float inv_len = 1.0f / ImSqrt(d2); VX *= inv_len; VY *= inv_len; } }
|
||||
#define IM_FIXNORMAL2F(VX,VY) { float d2 = VX*VX + VY*VY; if (d2 < 0.5f) d2 = 0.5f; float inv_lensq = 1.0f / d2; VX *= inv_lensq; VY *= inv_lensq; }
|
||||
#define IM_NORMALIZE2F_OVER_ZERO(VX,VY) do { float d2 = VX*VX + VY*VY; if (d2 > 0.0f) { float inv_len = 1.0f / ImSqrt(d2); VX *= inv_len; VY *= inv_len; } } while (0)
|
||||
#define IM_FIXNORMAL2F(VX,VY) do { float d2 = VX*VX + VY*VY; if (d2 < 0.5f) d2 = 0.5f; float inv_lensq = 1.0f / d2; VX *= inv_lensq; VY *= inv_lensq; } while (0)
|
||||
|
||||
// TODO: Thickness anti-aliased lines cap are missing their AA fringe.
|
||||
// We avoid using the ImVec2 math operators here to reduce cost to a minimum for debug/non-inlined builds.
|
||||
@ -680,7 +680,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
// Average normals
|
||||
float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;
|
||||
float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;
|
||||
IM_FIXNORMAL2F(dm_x, dm_y)
|
||||
IM_FIXNORMAL2F(dm_x, dm_y);
|
||||
dm_x *= AA_SIZE;
|
||||
dm_y *= AA_SIZE;
|
||||
|
||||
|
2
3rdparty/dear-imgui/imgui_internal.h
vendored
2
3rdparty/dear-imgui/imgui_internal.h
vendored
@ -866,7 +866,7 @@ struct ImGuiColumns
|
||||
// Helper function to calculate a circle's segment count given its radius and a "maximum error" value.
|
||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN 12
|
||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX 512
|
||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD,_MAXERROR) ImClamp((int)((IM_PI * 2.0f) / ImAcos((_RAD - _MAXERROR) / _RAD)), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX)
|
||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD,_MAXERROR) ImClamp((int)((IM_PI * 2.0f) / ImAcos(((_RAD) - (_MAXERROR)) / (_RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX)
|
||||
|
||||
// Data shared between all ImDrawList instances
|
||||
// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
|
||||
|
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@ -6360,6 +6360,10 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
flags |= ImGuiWindowFlags_ChildWindow;
|
||||
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
||||
}
|
||||
else
|
||||
{
|
||||
g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values
|
||||
}
|
||||
|
||||
return menu_is_open;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user