Merge branch 'master' into navigation
This commit is contained in:
commit
64031852de
33
imgui.cpp
33
imgui.cpp
@ -5156,17 +5156,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
||||||
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
||||||
|
|
||||||
// Update scrollbar status based on the Size that was effective during last frame (and not the upcoming Size which we are updating below), so that user code consuming exactly the available size won't trigger scrollbars when e.g. manually resizing.
|
|
||||||
if (!window->Collapsed)
|
|
||||||
{
|
|
||||||
window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
||||||
window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->SizeFull.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
||||||
if (window->ScrollbarX && !window->ScrollbarY)
|
|
||||||
window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
||||||
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
||||||
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
|
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
|
||||||
if (window->HiddenFrames > 0)
|
if (window->HiddenFrames > 0)
|
||||||
window->HiddenFrames--;
|
window->HiddenFrames--;
|
||||||
@ -5217,6 +5206,21 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Apply minimum/maximum window size constraints and final size
|
// Apply minimum/maximum window size constraints and final size
|
||||||
window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull);
|
window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull);
|
||||||
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
|
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
|
||||||
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
|
||||||
|
window->Size = window->SizeFull;
|
||||||
|
|
||||||
|
// SCROLLBAR STATUS
|
||||||
|
|
||||||
|
// Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). We need to do this before manual resize (below) is effective.
|
||||||
|
if (!window->Collapsed)
|
||||||
|
{
|
||||||
|
window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
||||||
|
window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->SizeFull.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
||||||
|
if (window->ScrollbarX && !window->ScrollbarY)
|
||||||
|
window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
||||||
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
||||||
|
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// POSITION
|
// POSITION
|
||||||
|
|
||||||
@ -5230,7 +5234,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
{
|
{
|
||||||
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
|
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
|
||||||
window->Pos = window->PosFloat = parent_window->DC.CursorPos;
|
window->Pos = window->PosFloat = parent_window->DC.CursorPos;
|
||||||
window->Size = window->SizeFull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);
|
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);
|
||||||
@ -5427,6 +5430,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));
|
window->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));
|
||||||
|
|
||||||
// Setup drawing context
|
// Setup drawing context
|
||||||
|
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
|
||||||
window->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x;
|
window->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x;
|
||||||
window->DC.GroupOffsetX = 0.0f;
|
window->DC.GroupOffsetX = 0.0f;
|
||||||
window->DC.ColumnsOffsetX = 0.0f;
|
window->DC.ColumnsOffsetX = 0.0f;
|
||||||
@ -7066,7 +7070,9 @@ bool ImGui::ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFla
|
|||||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||||
|
|
||||||
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
|
#ifdef IMGUI_HAS_NAV
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
|
#endif
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||||
RenderTriangle(bb.Min + padding, dir, 1.0f);
|
RenderTriangle(bb.Min + padding, dir, 1.0f);
|
||||||
|
|
||||||
@ -11696,9 +11702,10 @@ void ImGui::EndColumns()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw column
|
// Draw column
|
||||||
|
// We clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
|
||||||
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
||||||
const float xi = (float)(int)x;
|
const float xi = (float)(int)x;
|
||||||
window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
|
window->DrawList->AddLine(ImVec2(xi, ImMax(y1 + 1.0f, window->ClipRect.Min.y)), ImVec2(xi, ImMin(y2, window->ClipRect.Max.y)), col);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
|
// Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
|
||||||
|
@ -1656,14 +1656,19 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("Horizontal Scrolling"))
|
if (ImGui::TreeNode("Horizontal Scrolling"))
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowContentWidth(1500);
|
ImGui::SetNextWindowContentWidth(1500);
|
||||||
ImGui::BeginChild("##scrollingregion", ImVec2(0, 120), false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
ImGui::Columns(10);
|
ImGui::Columns(10);
|
||||||
for (int i = 0; i < 20; i++)
|
int ITEMS_COUNT = 2000;
|
||||||
for (int j = 0; j < 10; j++)
|
ImGuiListClipper clipper(ITEMS_COUNT); // Also demonstrate using the clipper for large list
|
||||||
{
|
while (clipper.Step())
|
||||||
ImGui::Text("Line %d Column %d...", i, j);
|
{
|
||||||
ImGui::NextColumn();
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
}
|
for (int j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
ImGui::Text("Line %d Column %d...", i, j);
|
||||||
|
ImGui::NextColumn();
|
||||||
|
}
|
||||||
|
}
|
||||||
ImGui::Columns(1);
|
ImGui::Columns(1);
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2365,7 +2370,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
points.pop_back();
|
points.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
|
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.)
|
||||||
for (int i = 0; i < points.Size - 1; i += 2)
|
for (int i = 0; i < points.Size - 1; i += 2)
|
||||||
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
|
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
|
||||||
draw_list->PopClipRect();
|
draw_list->PopClipRect();
|
||||||
|
Loading…
Reference in New Issue
Block a user