From 9262f1bc59a0efda14e7d0ee9d74865814d72465 Mon Sep 17 00:00:00 2001 From: Piotr Grabowski Date: Sat, 10 Aug 2024 12:52:49 +0200 Subject: [PATCH] fix(scroll): make auto-scroll on page change work consistently --- scrolling.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scrolling.go b/scrolling.go index 3e656a6..f4d9691 100644 --- a/scrolling.go +++ b/scrolling.go @@ -95,6 +95,7 @@ func (app *App) scroll(dx, dy float64) { } func (app *App) scrollToStart() { + app.W.ScrolledWindow.SetVAdjustment(nil) // Needed to prevent a bug where it scrolls back by itself app.W.ScrolledWindow.GetVAdjustment().SetValue(0) // Vertical: top var newHadj float64 = 0 @@ -102,18 +103,21 @@ func (app *App) scrollToStart() { imgw, _ := app.getImageAreaInnerSize() newHadj = float64(imgw) } + app.W.ScrolledWindow.SetHAdjustment(nil) app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (non-manga) or right (manga) edge } func (app *App) scrollToEnd() { imgw, imgh := app.getImageAreaInnerSize() + app.W.ScrolledWindow.SetVAdjustment(nil) app.W.ScrolledWindow.GetVAdjustment().SetValue(float64(imgh)) // Vertical: bottom var newHadj float64 = 0 if !app.Config.MangaMode { newHadj = float64(imgw) } + app.W.ScrolledWindow.SetHAdjustment(nil) app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (manga) or right (non-manga) edge }