psydack / uimgui

UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project.
MIT License
343 stars 53 forks source link

[BUG] Overly-slow mouse scroll wheel #69

Open tenpn opened 1 month ago

tenpn commented 1 month ago

Describe the bug Scrolling the contents of a window takes many more mouse wheel rotations than expected, on my logitech G402 mouse, using the unity input system. This is consistent in builds and editor, windowed mode and full-screen.

Version/Branch of UImGui: Version: 4.1.0

Unity Version 2023.2.13

Render pipeline (HDRP / URP / Built-in) URP

Expected behavior A single tick of the scroll wheel should scroll a lot more lines. Or, there should be a way to tune this on a per-project basis.

If I remove the /120 on line 79 of InputSystemPlatform.cs, I get scrolling much closer to what I expect.

In the video, you'll have to believe me that I'm furiously scrolling the mouse wheel!

Here's the code shown in the video:

        private void OnLayout(UImGui.UImGui obj)
        {
            if (ImGui.Begin("DearDebugConsole") == false)
            {
                ImGui.End();
            }

            if (ImGui.SmallButton("Test"))
            {

            }
            ImGui.SameLine();
            if (ImGui.SmallButton("Clear"))
            {

            }
            ImGui.SameLine();
            if (ImGui.SmallButton("Copy"))
            {

            }

            ImGui.Separator();

            float footerToReserve = 0;//ImGui.GetFrameHeight();
            if (ImGui.BeginChild("Logs", Vector2.down * footerToReserve))
            {
                for (int i = 0; i < 1000; ++i)
                {
                    ImGui.SetItemAllowOverlap();

                    if (ImGui.Selectable(i.ToString("000"), i == m_selectedLineIndex))
                    {
                        m_selectedLineIndex = i;
                    }
                    ImGui.SameLine();
                    ImGui.TextColored(new Vector4(1f, 1f, 0), "⚠");
                    ImGui.SameLine();
                    ImGui.TextColored(s_cols[i%s_cols.Length], "Some text!");
                }
                ImGui.EndChild();
            }
        }

https://github.com/user-attachments/assets/558b6a11-771c-40c6-87da-b7f947431f12