Skip to content

Commit 4986dba

Browse files
committed
Scrolling: Fixed scrolling centering API leading to non-integer scrolling values and initial cursor position. (ocornut#3073)
This would often get fixed after the fix item submission, but using the ImGuiListClipper as the first thing after Begin() could largely break size calculations. (ocornut#3073)
1 parent 110f506 commit 4986dba

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Other Changes:
4545
when the menu is not open. (#3030)
4646
- InputText: Fixed password fields displaying ASCII spaces as blanks instead of using the '*'
4747
glyph. (#2149, #515)
48+
- Scrolling: Fixed scrolling centering API leading to non-integer scrolling values and initial
49+
cursor position. This would often get fixed after the fix item submission, but using the
50+
ImGuiListClipper as the first thing after Begin() could largely break size calculations. (#3073)
4851
- Added optional support for Unicode plane 1-16 (#2538, #2541, #2815) [@cloudwu, @samhocevar]
4952
- Compile-time enable with '#define ImWchar ImWchar32' in imconfig.h.
5053
- Generally more consistent support for unsupported codepoints (0xFFFD), in particular when

imgui.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7283,7 +7283,8 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool s
72837283
target_y = window->ContentSize.y + window->WindowPadding.y * 2.0f;
72847284
scroll.y = target_y - cr_y * (window->SizeFull.y - window->ScrollbarSizes.y - decoration_up_height);
72857285
}
7286-
scroll = ImMax(scroll, ImVec2(0.0f, 0.0f));
7286+
scroll.x = IM_FLOOR(ImMax(scroll.x, 0.0f));
7287+
scroll.y = IM_FLOOR(ImMax(scroll.y, 0.0f));
72877288
if (!window->Collapsed && !window->SkipItems)
72887289
{
72897290
scroll.x = ImMin(scroll.x, window->ScrollMax.x);

0 commit comments

Comments
 (0)