You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scrolling: Avoid SetScroll, SetScrollFromPos functions from snapping on the edge of scroll limits. (#3379) + Demo: Rename "Layout" to "Layout & Scrolling".
// 'snap_on_edges' allows for a discontinuity at the edge of scrolling limits to take account of WindowPadding so that scrolling to make the last item visible scroll far enough to see the padding.
local_y -= window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect
target_x += (last_item_width * center_x_ratio) + (g.Style.ItemSpacing.x * (center_x_ratio - 0.5f) * 2.0f); // Precisely aim before, in the middle or after the last item.
// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.
7487
7494
void ImGui::SetScrollHereY(float center_y_ratio)
7488
7495
{
7489
7496
ImGuiContext& g = *GImGui;
7490
7497
ImGuiWindow* window = g.CurrentWindow;
7491
-
float target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space
7492
-
target_y += (window->DC.PrevLineSize.y * center_y_ratio) + (g.Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line.
Copy file name to clipboardExpand all lines: imgui.h
+2-2
Original file line number
Diff line number
Diff line change
@@ -333,8 +333,8 @@ namespace ImGui
333
333
// Windows Scrolling
334
334
IMGUI_API floatGetScrollX(); // get scrolling amount [0..GetScrollMaxX()]
335
335
IMGUI_API floatGetScrollY(); // get scrolling amount [0..GetScrollMaxY()]
336
-
IMGUI_API floatGetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.X - WindowSize.X
337
-
IMGUI_API floatGetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y
336
+
IMGUI_API floatGetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x
337
+
IMGUI_API floatGetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y
338
338
IMGUI_API voidSetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
339
339
IMGUI_API voidSetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
340
340
IMGUI_API voidSetScrollHereX(float center_x_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
0 commit comments