Skip to content

Commit 8f495e5

Browse files
committed
Internal: added ScrollToItem() upcoming replacement to ScrollToBringRectIntoView() + ImGuiScrollFlags (WIP) (#3692, #3208, #2812, #4242, #2900)
1 parent fc4988f commit 8f495e5

File tree

5 files changed

+108
-30
lines changed

5 files changed

+108
-30
lines changed

docs/CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Other Changes:
6262
the PressedOnClick/PressedOnDoubleClick/PressedOnRelease button policy.
6363
- Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation
6464
is disabled. (#4547, #4439) [@PathogenDavid]
65+
- Nav: Improve scrolling behavior when navigating to an item larger than view.
6566
- TreePush(): removed unnecessary/inconsistent legacy behavior where passing a NULL value to
6667
the TreePush(const char*) and TreePush(const void*) functions would use an hardcoded replacement.
6768
The only situation where that change would make a meaningful difference is TreePush((const char*)NULL)

imgui.cpp

+76-24
Original file line numberDiff line numberDiff line change
@@ -8008,32 +8008,80 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
80088008
return scroll;
80098009
}
80108010

8011+
void ImGui::ScrollToItem(ImGuiScrollFlags flags)
8012+
{
8013+
ImGuiContext& g = *GImGui;
8014+
ImGuiWindow* window = g.CurrentWindow;
8015+
ScrollToRectEx(window, g.LastItemData.NavRect, flags);
8016+
}
8017+
8018+
void ImGui::ScrollToRect(ImGuiWindow* window, const ImRect& item_rect, ImGuiScrollFlags flags)
8019+
{
8020+
ScrollToRectEx(window, item_rect, flags);
8021+
}
8022+
80118023
// Scroll to keep newly navigated item fully into view
8012-
ImVec2 ImGui::ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect)
8024+
ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGuiScrollFlags flags)
80138025
{
80148026
ImGuiContext& g = *GImGui;
80158027
ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1));
80168028
//GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
80178029

8018-
ImVec2 delta_scroll;
8019-
if (!window_rect.Contains(item_rect))
8030+
// Check that only one behavior is selected per axis
8031+
IM_ASSERT((flags & ImGuiScrollFlags_MaskX_) == 0 || ImIsPowerOfTwo(flags & ImGuiScrollFlags_MaskX_));
8032+
IM_ASSERT((flags & ImGuiScrollFlags_MaskY_) == 0 || ImIsPowerOfTwo(flags & ImGuiScrollFlags_MaskY_));
8033+
8034+
// Defaults
8035+
ImGuiScrollFlags in_flags = flags;
8036+
if ((flags & ImGuiScrollFlags_MaskX_) == 0 && window->ScrollbarX)
8037+
flags |= ImGuiScrollFlags_KeepVisibleEdgeX;
8038+
if ((flags & ImGuiScrollFlags_MaskY_) == 0)
8039+
flags |= window->Appearing ? ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeY;
8040+
8041+
const bool fully_visible_x = item_rect.Min.x >= window_rect.Min.x && item_rect.Max.x <= window_rect.Max.x;
8042+
const bool fully_visible_y = item_rect.Min.y >= window_rect.Min.y && item_rect.Max.y <= window_rect.Max.y;
8043+
const bool can_be_fully_visible_x = item_rect.GetWidth() <= window_rect.GetWidth();
8044+
const bool can_be_fully_visible_y = item_rect.GetHeight() <= window_rect.GetHeight();
8045+
8046+
if ((flags & ImGuiScrollFlags_KeepVisibleEdgeX) && !fully_visible_x)
80208047
{
8021-
if (window->ScrollbarX && item_rect.Min.x < window_rect.Min.x)
8022-
SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x - g.Style.ItemSpacing.x, 0.0f);
8023-
else if (window->ScrollbarX && item_rect.Max.x >= window_rect.Max.x)
8024-
SetScrollFromPosX(window, item_rect.Max.x - window->Pos.x + g.Style.ItemSpacing.x, 1.0f);
8025-
if (item_rect.Min.y < window_rect.Min.y)
8026-
SetScrollFromPosY(window, item_rect.Min.y - window->Pos.y - g.Style.ItemSpacing.y, 0.0f);
8027-
else if (item_rect.Max.y >= window_rect.Max.y)
8028-
SetScrollFromPosY(window, item_rect.Max.y - window->Pos.y + g.Style.ItemSpacing.y, 1.0f);
8048+
if (item_rect.Min.x < window_rect.Min.x || !can_be_fully_visible_x)
8049+
SetScrollFromPosX(window, item_rect.Min.x - g.Style.ItemSpacing.x - window->Pos.x, 0.0f);
8050+
else if (item_rect.Max.x >= window_rect.Max.x)
8051+
SetScrollFromPosX(window, item_rect.Max.x + g.Style.ItemSpacing.x - window->Pos.x, 1.0f);
8052+
}
8053+
else if (((flags & ImGuiScrollFlags_KeepVisibleCenterX) && !fully_visible_x) || (flags & ImGuiScrollFlags_AlwaysCenterX))
8054+
{
8055+
float target_x = can_be_fully_visible_x ? ImFloor((item_rect.Min.x + item_rect.Max.x - window->InnerRect.GetWidth()) * 0.5f) : item_rect.Min.x;
8056+
SetScrollFromPosX(window, target_x - window->Pos.x, 0.0f);
8057+
}
80298058

8030-
ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window);
8031-
delta_scroll = next_scroll - window->Scroll;
8059+
if ((flags & ImGuiScrollFlags_KeepVisibleEdgeY) && !fully_visible_y)
8060+
{
8061+
if (item_rect.Min.y < window_rect.Min.y || !can_be_fully_visible_y)
8062+
SetScrollFromPosY(window, item_rect.Min.y - g.Style.ItemSpacing.y - window->Pos.y, 0.0f);
8063+
else if (item_rect.Max.y >= window_rect.Max.y)
8064+
SetScrollFromPosY(window, item_rect.Max.y + g.Style.ItemSpacing.y - window->Pos.y, 1.0f);
80328065
}
8066+
else if (((flags & ImGuiScrollFlags_KeepVisibleCenterY) && !fully_visible_y) || (flags & ImGuiScrollFlags_AlwaysCenterY))
8067+
{
8068+
float target_y = can_be_fully_visible_y ? ImFloor((item_rect.Min.y + item_rect.Max.y - window->InnerRect.GetHeight()) * 0.5f) : item_rect.Min.y;
8069+
SetScrollFromPosY(window, target_y - window->Pos.y, 0.0f);
8070+
}
8071+
8072+
ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window);
8073+
ImVec2 delta_scroll = next_scroll - window->Scroll;
80338074

80348075
// Also scroll parent window to keep us into view if necessary
8035-
if (window->Flags & ImGuiWindowFlags_ChildWindow)
8036-
delta_scroll += ScrollToBringRectIntoView(window->ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll));
8076+
if (!(flags & ImGuiScrollFlags_NoScrollParent) && (window->Flags & ImGuiWindowFlags_ChildWindow))
8077+
{
8078+
// FIXME-SCROLL: May be an option?
8079+
if ((in_flags & (ImGuiScrollFlags_AlwaysCenterX | ImGuiScrollFlags_KeepVisibleCenterX)) != 0)
8080+
in_flags = (in_flags & ~ImGuiScrollFlags_MaskX_) | ImGuiScrollFlags_KeepVisibleEdgeX;
8081+
if ((in_flags & (ImGuiScrollFlags_AlwaysCenterY | ImGuiScrollFlags_KeepVisibleCenterY)) != 0)
8082+
in_flags = (in_flags & ~ImGuiScrollFlags_MaskY_) | ImGuiScrollFlags_KeepVisibleEdgeY;
8083+
delta_scroll += ScrollToRectEx(window->ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll), in_flags);
8084+
}
80378085

80388086
return delta_scroll;
80398087
}
@@ -9026,7 +9074,7 @@ bool ImGui::NavMoveRequestButNoResultYet()
90269074
}
90279075

90289076
// FIXME: ScoringRect is not set
9029-
void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags)
9077+
void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags)
90309078
{
90319079
ImGuiContext& g = *GImGui;
90329080
IM_ASSERT(g.NavWindow != NULL);
@@ -9035,6 +9083,7 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM
90359083
g.NavMoveDirForDebug = move_dir;
90369084
g.NavMoveClipDir = clip_dir;
90379085
g.NavMoveFlags = move_flags;
9086+
g.NavMoveScrollFlags = scroll_flags;
90389087
g.NavMoveForwardToNextFrame = false;
90399088
g.NavMoveKeyMods = g.IO.KeyMods;
90409089
g.NavMoveResultLocal.Clear();
@@ -9051,7 +9100,7 @@ void ImGui::NavMoveRequestCancel()
90519100
}
90529101

90539102
// Forward will reuse the move request again on the next frame (generally with modifications done to it)
9054-
void ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags)
9103+
void ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags)
90559104
{
90569105
ImGuiContext& g = *GImGui;
90579106
IM_ASSERT(g.NavMoveForwardToNextFrame == false);
@@ -9060,6 +9109,7 @@ void ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNav
90609109
g.NavMoveDir = move_dir;
90619110
g.NavMoveClipDir = clip_dir;
90629111
g.NavMoveFlags = move_flags | ImGuiNavMoveFlags_Forwarded;
9112+
g.NavMoveScrollFlags = scroll_flags;
90639113
}
90649114

90659115
// Navigation wrap-around logic is delayed to the end of the frame because this operation is only valid after entire
@@ -9422,6 +9472,7 @@ void ImGui::NavUpdateCreateMoveRequest()
94229472
// Initiate directional inputs request
94239473
g.NavMoveDir = ImGuiDir_None;
94249474
g.NavMoveFlags = ImGuiNavMoveFlags_None;
9475+
g.NavMoveScrollFlags = ImGuiScrollFlags_None;
94259476
if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
94269477
{
94279478
const ImGuiInputReadMode read_mode = ImGuiInputReadMode_Repeat;
@@ -9454,7 +9505,7 @@ void ImGui::NavUpdateCreateMoveRequest()
94549505
// Submit
94559506
g.NavMoveForwardToNextFrame = false;
94569507
if (g.NavMoveDir != ImGuiDir_None)
9457-
NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags);
9508+
NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags);
94589509

94599510
// Moving with no reference triggers a init request (will be used as a fallback if the direction fails to find a match)
94609511
if (g.NavMoveSubmitted && g.NavId == 0)
@@ -9534,16 +9585,17 @@ void ImGui::NavMoveRequestApplyResult()
95349585
if (g.NavLayer == ImGuiNavLayer_Main)
95359586
{
95369587
ImVec2 delta_scroll;
9537-
if (g.NavMoveFlags & ImGuiNavMoveFlags_ScrollToEdge)
9588+
if (g.NavMoveFlags & ImGuiNavMoveFlags_ScrollToEdgeY)
95389589
{
9590+
// FIXME: Should remove this
95399591
float scroll_target = (g.NavMoveDir == ImGuiDir_Up) ? result->Window->ScrollMax.y : 0.0f;
95409592
delta_scroll.y = result->Window->Scroll.y - scroll_target;
95419593
SetScrollY(result->Window, scroll_target);
95429594
}
95439595
else
95449596
{
95459597
ImRect rect_abs = ImRect(result->RectRel.Min + result->Window->Pos, result->RectRel.Max + result->Window->Pos);
9546-
delta_scroll = ScrollToBringRectIntoView(result->Window, rect_abs);
9598+
delta_scroll = ScrollToRectEx(result->Window, rect_abs, g.NavMoveScrollFlags);
95479599
}
95489600

95499601
// Offset our result position so mouse position can be applied immediately after in NavUpdate()
@@ -9670,13 +9722,13 @@ static float ImGui::NavUpdatePageUpPageDown()
96709722
else if (home_pressed)
96719723
{
96729724
// FIXME-NAV: handling of Home/End is assuming that the top/bottom most item will be visible with Scroll.y == 0/ScrollMax.y
9673-
// Scrolling will be handled via the ImGuiNavMoveFlags_ScrollToEdge flag, we don't scroll immediately to avoid scrolling happening before nav result.
9725+
// Scrolling will be handled via the ImGuiNavMoveFlags_ScrollToEdgeY flag, we don't scroll immediately to avoid scrolling happening before nav result.
96749726
// Preserve current horizontal position if we have any.
96759727
nav_rect_rel.Min.y = nav_rect_rel.Max.y = -window->Scroll.y;
96769728
if (nav_rect_rel.IsInverted())
96779729
nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;
96789730
g.NavMoveDir = ImGuiDir_Down;
9679-
g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdge;
9731+
g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdgeY;
96809732
// FIXME-NAV: MoveClipDir left to _None, intentional?
96819733
}
96829734
else if (end_pressed)
@@ -9685,7 +9737,7 @@ static float ImGui::NavUpdatePageUpPageDown()
96859737
if (nav_rect_rel.IsInverted())
96869738
nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;
96879739
g.NavMoveDir = ImGuiDir_Up;
9688-
g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdge;
9740+
g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdgeY;
96899741
// FIXME-NAV: MoveClipDir left to _None, intentional?
96909742
}
96919743
return nav_scoring_rect_offset_y;
@@ -9756,7 +9808,7 @@ static void ImGui::NavEndFrame()
97569808
if (do_forward)
97579809
{
97589810
window->NavRectRel[g.NavLayer] = bb_rel;
9759-
NavMoveRequestForward(g.NavMoveDir, clip_dir, move_flags);
9811+
NavMoveRequestForward(g.NavMoveDir, clip_dir, move_flags, g.NavMoveScrollFlags);
97609812
}
97619813
}
97629814
}

imgui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Index of this file:
6464
// Version
6565
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
6666
#define IMGUI_VERSION "1.85 WIP"
67-
#define IMGUI_VERSION_NUM 18417
67+
#define IMGUI_VERSION_NUM 18418
6868
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
6969
#define IMGUI_HAS_TABLE
7070

imgui_internal.h

+29-4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // F
152152
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
153153
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
154154
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
155+
typedef int ImGuiScrollFlags; // -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
155156
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
156157
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
157158
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
@@ -1175,6 +1176,21 @@ enum ImGuiActivateFlags_
11751176
ImGuiActivateFlags_TryToPreserveState = 1 << 2 // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
11761177
};
11771178

1179+
// Early work-in-progress API for ScrollToItem()
1180+
enum ImGuiScrollFlags_
1181+
{
1182+
ImGuiScrollFlags_None = 0,
1183+
ImGuiScrollFlags_KeepVisibleEdgeX = 1 << 0, // If item is not visible: scroll as little as possible on X axis to bring item back into view [default for X axis]
1184+
ImGuiScrollFlags_KeepVisibleEdgeY = 1 << 1, // If item is not visible: scroll as little as possible on Y axis to bring item back into view [default for Y axis for windows that are already visible]
1185+
ImGuiScrollFlags_KeepVisibleCenterX = 1 << 2, // If item is not visible: scroll to make the item centered on X axis [rarely used]
1186+
ImGuiScrollFlags_KeepVisibleCenterY = 1 << 3, // If item is not visible: scroll to make the item centered on Y axis
1187+
ImGuiScrollFlags_AlwaysCenterX = 1 << 4, // Always center the result item on X axis [rarely used]
1188+
ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window)
1189+
ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
1190+
ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX,
1191+
ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY
1192+
};
1193+
11781194
enum ImGuiNavHighlightFlags_
11791195
{
11801196
ImGuiNavHighlightFlags_None = 0,
@@ -1201,7 +1217,7 @@ enum ImGuiNavMoveFlags_
12011217
ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful but provided for completeness
12021218
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
12031219
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
1204-
ImGuiNavMoveFlags_ScrollToEdge = 1 << 6,
1220+
ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
12051221
ImGuiNavMoveFlags_Forwarded = 1 << 7,
12061222
ImGuiNavMoveFlags_DebugNoResult = 1 << 8
12071223
};
@@ -1536,6 +1552,7 @@ struct ImGuiContext
15361552
bool NavMoveScoringItems; // Move request submitted, still scoring incoming items
15371553
bool NavMoveForwardToNextFrame;
15381554
ImGuiNavMoveFlags NavMoveFlags;
1555+
ImGuiScrollFlags NavMoveScrollFlags;
15391556
ImGuiKeyModFlags NavMoveKeyMods;
15401557
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
15411558
ImGuiDir NavMoveDirForDebug;
@@ -1742,6 +1759,7 @@ struct ImGuiContext
17421759
NavMoveScoringItems = false;
17431760
NavMoveForwardToNextFrame = false;
17441761
NavMoveFlags = ImGuiNavMoveFlags_None;
1762+
NavMoveScrollFlags = ImGuiScrollFlags_None;
17451763
NavMoveKeyMods = ImGuiKeyModFlags_None;
17461764
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
17471765
NavScoringDebugCount = 0;
@@ -2390,7 +2408,14 @@ namespace ImGui
23902408
IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y);
23912409
IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);
23922410
IMGUI_API void SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);
2393-
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);
2411+
2412+
// Early work-in-progress API (ScrollToItem() will become public)
2413+
IMGUI_API void ScrollToItem(ImGuiScrollFlags flags = 0);
2414+
IMGUI_API void ScrollToRect(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
2415+
IMGUI_API ImVec2 ScrollToRectEx(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
2416+
//#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2417+
inline void ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& rect) { ScrollToRect(window, rect, ImGuiScrollFlags_KeepVisibleEdgeY); }
2418+
//#endif
23942419

23952420
// Basic Accessors
23962421
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
@@ -2471,8 +2496,8 @@ namespace ImGui
24712496
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
24722497
IMGUI_API void NavInitRequestApplyResult();
24732498
IMGUI_API bool NavMoveRequestButNoResultYet();
2474-
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags);
2475-
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags);
2499+
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
2500+
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
24762501
IMGUI_API void NavMoveRequestCancel();
24772502
IMGUI_API void NavMoveRequestApplyResult();
24782503
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);

imgui_widgets.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6716,7 +6716,7 @@ void ImGui::EndMenuBar()
67166716
SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]);
67176717
g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection.
67186718
g.NavDisableMouseHover = g.NavMousePosDirty = true;
6719-
NavMoveRequestForward(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags); // Repeat
6719+
NavMoveRequestForward(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags); // Repeat
67206720
}
67216721
}
67226722

0 commit comments

Comments
 (0)