From c116dad3048d1bcaa8c7ffad6268b7a035973a47 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 8 Feb 2015 13:29:55 +0000 Subject: [PATCH] Fixed holdng scrollbar creating a small feedback loop with calculation of contents size --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 842f113b..df386da1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2781,7 +2781,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph { g.HoveredId = scrollbar_id; const float pos_y_norm = ImSaturate((g.IO.MousePos.y - (scrollbar_bb.Min.y + grab_size_y*0.5f)) / (scrollbar_bb.GetHeight() - grab_size_y)) * (1.0f - grab_size_y_norm); - window->ScrollY = pos_y_norm * window->SizeContentsFit.y; + window->ScrollY = (float)(int)(pos_y_norm * window->SizeContentsFit.y); window->NextScrollY = window->ScrollY; } }