|
@@ -4840,10 +4840,10 @@ struct ImGuiResizeGripDef
|
|
|
|
|
|
static const ImGuiResizeGripDef resize_grip_def[4] =
|
|
|
{
|
|
|
- { ImVec2(1,1), ImVec2(-1,-1), 0, 3 }, // Lower right
|
|
|
- { ImVec2(0,1), ImVec2(+1,-1), 3, 6 }, // Lower left
|
|
|
- { ImVec2(0,0), ImVec2(+1,+1), 6, 9 }, // Upper left
|
|
|
- { ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper right
|
|
|
+ { ImVec2(1,1), ImVec2(-1,-1), 0, 3 }, // Lower-right
|
|
|
+ { ImVec2(0,1), ImVec2(+1,-1), 3, 6 }, // Lower-left
|
|
|
+ { ImVec2(0,0), ImVec2(+1,+1), 6, 9 }, // Upper-left (Unused)
|
|
|
+ { ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper-right (Unused)
|
|
|
};
|
|
|
|
|
|
static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness)
|
|
@@ -4858,6 +4858,17 @@ static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_
|
|
|
return ImRect();
|
|
|
}
|
|
|
|
|
|
+// 0..3: corners (Lower-right, Lower-left, Unused, Unused)
|
|
|
+// 4..7: borders (Top, Right, Bottom, Left)
|
|
|
+ImGuiID ImGui::GetWindowResizeID(ImGuiWindow* window, int n)
|
|
|
+{
|
|
|
+ IM_ASSERT(n >= 0 && n <= 7);
|
|
|
+ ImGuiID id = window->ID;
|
|
|
+ id = ImHashStr("#RESIZE", 0, id);
|
|
|
+ id = ImHashData(&n, sizeof(int), id);
|
|
|
+ return id;
|
|
|
+}
|
|
|
+
|
|
|
// Handle resize for: Resize Grips, Borders, Gamepad
|
|
|
// Return true when using auto-fit (double click on resize grip)
|
|
|
static bool ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4])
|
|
@@ -4895,7 +4906,7 @@ static bool ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
|
|
if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);
|
|
|
if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);
|
|
|
bool hovered, held;
|
|
|
- ButtonBehavior(resize_rect, window->GetID((void*)(intptr_t)resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
|
|
|
+ ButtonBehavior(resize_rect, window->GetID(resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
|
|
|
//GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
|
|
|
if (hovered || held)
|
|
|
g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;
|
|
@@ -4921,7 +4932,7 @@ static bool ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
|
|
{
|
|
|
bool hovered, held;
|
|
|
ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS);
|
|
|
- ButtonBehavior(border_rect, window->GetID((void*)(intptr_t)(border_n + 4)), &hovered, &held, ImGuiButtonFlags_FlattenChildren);
|
|
|
+ ButtonBehavior(border_rect, window->GetID(border_n + 4), &hovered, &held, ImGuiButtonFlags_FlattenChildren);
|
|
|
//GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
|
|
|
if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)
|
|
|
{
|
|
@@ -5822,14 +5833,14 @@ void ImGui::End()
|
|
|
// Error checking: verify that user hasn't called End() too many times!
|
|
|
if (g.CurrentWindowStack.Size <= 1 && g.WithinFrameScopeWithImplicitWindow)
|
|
|
{
|
|
|
- IMGUI_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
|
|
+ IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
|
|
return;
|
|
|
}
|
|
|
IM_ASSERT(g.CurrentWindowStack.Size > 0);
|
|
|
|
|
|
// Error checking: verify that user doesn't directly call End() on a child window.
|
|
|
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
|
|
- IMGUI_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");
|
|
|
+ IM_ASSERT_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");
|
|
|
|
|
|
// Close anything that is open
|
|
|
if (window->DC.CurrentColumns)
|
|
@@ -7003,13 +7014,13 @@ static void ImGui::ErrorCheckEndFrame()
|
|
|
{
|
|
|
if (g.CurrentWindowStack.Size > 1)
|
|
|
{
|
|
|
- IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
|
|
+ IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
|
|
while (g.CurrentWindowStack.Size > 1)
|
|
|
End();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
|
|
+ IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
|
|
}
|
|
|
}
|
|
|
|