aarzilli / gdlv

GUI frontend for Delve
Other
1.34k stars 48 forks source link

Drag scrolling (on macOS laptop with a retina display) is too fast #58

Open dr2chase opened 2 years ago

dr2chase commented 2 years ago

There may be a way to adjust this, but I could not find it.

What I want is to scroll with drag gestures on my trackpad; this "works" but instead of scrolling a few lines, unless I am very careful with my drag motion, the contents of the window fly past too quickly.

I wonder if this is an interaction with the magnification/zoom for a retina display.

aarzilli commented 2 years ago

In vendor/github.com/aarzilli/nucular/gio.go there's a line that says mw.ctx.Input.Mouse.ScrollDelta++ (and --). I imagine the event that executes that gets generated many many times with the drag motion, for some reason. The zoom factor doesn't matter.

dr2chase commented 2 years ago

I am not sure how to connect this to preferences or to automatically figure out if this would be a good idea, but this change helped with trackpad drag scrolling and seemed not to hurt anything else:

diff --git a/vendor/github.com/aarzilli/nucular/nucular.go b/vendor/github.com/aarzilli/nucular/nucular.go
index 7e4967c..f851cbc 100644
--- a/vendor/github.com/aarzilli/nucular/nucular.go
+++ b/vendor/github.com/aarzilli/nucular/nucular.go
@@ -1927,6 +1927,8 @@ func doScrollbarv(win *Window, scroll, scrollwheel_bounds rect.Rect, offset floa
        var scroll_off float64
        var scroll_ratio float64

+       step /= 4
+
        if scroll.W < 1 {
                scroll.W = 1
        }
@@ -2015,6 +2017,8 @@ func doScrollbarh(win *Window, scroll rect.Rect, offset float64, target float64,
        var scroll_off float64
        var scroll_ratio float64

+       step /= 4
+
        /* scrollbar background */
        if scroll.H < 1 {
                scroll.H = 1
aarzilli commented 2 years ago

Assuming the normalization that gio does is correct 6a21078a2e0c5f92f61a02771a79d9f817f2c963 should be the right way to do it, is it too slow?

dr2chase commented 2 years ago

That is not too slow -- it is better, but not slow enough. When I combined that with my step /=4 hack above, perhaps it is too slow, but only perhaps, not definitely.