From 8238870cc5156f5ad535bca40792e393e4ade366 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Wed, 31 Dec 2025 16:06:10 -0500 Subject: [PATCH] feat(ui): Add fast scroll with 2.5x speed multiplier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created NewFastVScroll widget with customizable scroll speed - Intercepts scroll events and multiplies delta by 2.5x - Applied to Convert module (Simple and Advanced tabs) - Applied to Settings module - Significantly improves scrolling responsiveness 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- internal/ui/components.go | 61 ++++++++++++++++++++++++++++++++++++++- main.go | 8 ++--- settings_module.go | 4 +-- 3 files changed, 65 insertions(+), 8 deletions(-) diff --git a/internal/ui/components.go b/internal/ui/components.go index 7a791d3..01cd6e1 100644 --- a/internal/ui/components.go +++ b/internal/ui/components.go @@ -440,6 +440,58 @@ func (r *droppableRenderer) Objects() []fyne.CanvasObject { return []fyne.CanvasObject{r.content} } +// FastVScroll creates a vertical scroll container with faster scroll speed +type FastVScroll struct { + widget.BaseWidget + scroll *container.Scroll +} + +// NewFastVScroll creates a new fast-scrolling vertical scroll container +func NewFastVScroll(content fyne.CanvasObject) *FastVScroll { + f := &FastVScroll{ + scroll: container.NewVScroll(content), + } + f.ExtendBaseWidget(f) + return f +} + +func (f *FastVScroll) CreateRenderer() fyne.WidgetRenderer { + return &fastScrollRenderer{scroll: f.scroll} +} + +func (f *FastVScroll) Scrolled(ev *fyne.ScrollEvent) { + // Multiply scroll speed by 2.5x for faster scrolling + fastEvent := &fyne.ScrollEvent{ + Scrolled: fyne.Delta{ + DX: ev.Scrolled.DX * 2.5, + DY: ev.Scrolled.DY * 2.5, + }, + } + f.scroll.Scrolled(fastEvent) +} + +type fastScrollRenderer struct { + scroll *container.Scroll +} + +func (r *fastScrollRenderer) Layout(size fyne.Size) { + r.scroll.Resize(size) +} + +func (r *fastScrollRenderer) MinSize() fyne.Size { + return r.scroll.MinSize() +} + +func (r *fastScrollRenderer) Refresh() { + r.scroll.Refresh() +} + +func (r *fastScrollRenderer) Objects() []fyne.CanvasObject { + return []fyne.CanvasObject{r.scroll} +} + +func (r *fastScrollRenderer) Destroy() {} + // DraggableVScroll creates a vertical scroll container with draggable track type DraggableVScroll struct { widget.BaseWidget @@ -524,7 +576,14 @@ func (d *DraggableVScroll) Tapped(ev *fyne.PointEvent) { // Scrolled handles scroll events (mouse wheel) func (d *DraggableVScroll) Scrolled(ev *fyne.ScrollEvent) { - d.scroll.Scrolled(ev) + // Multiply scroll speed by 2.5x for faster scrolling + fastEvent := &fyne.ScrollEvent{ + Scrolled: fyne.Delta{ + DX: ev.Scrolled.DX * 2.5, + DY: ev.Scrolled.DY * 2.5, + }, + } + d.scroll.Scrolled(fastEvent) } type draggableScrollRenderer struct { diff --git a/main.go b/main.go index f993ac0..5e496fd 100644 --- a/main.go +++ b/main.go @@ -8479,11 +8479,9 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { // Wrap simple options with settings box at top simpleWithSettings := container.NewVBox(settingsBox, simpleOptions) - // Both Simple and Advanced get their own scrolling - simpleScrollBox := container.NewVScroll(simpleWithSettings) - simpleScrollBox.SetMinSize(fyne.NewSize(0, 0)) - advancedScrollBox := container.NewVScroll(advancedOptions) - advancedScrollBox.SetMinSize(fyne.NewSize(0, 0)) + // Both Simple and Advanced get their own fast scrolling (2.5x speed) + simpleScrollBox := ui.NewFastVScroll(simpleWithSettings) + advancedScrollBox := ui.NewFastVScroll(advancedOptions) if updateQualityVisibility != nil { updateQualityVisibility() diff --git a/settings_module.go b/settings_module.go index cb969c0..6cc7bb3 100644 --- a/settings_module.go +++ b/settings_module.go @@ -165,8 +165,8 @@ func buildSettingsView(state *appState) fyne.CanvasObject { ) tabs.SetTabLocation(container.TabLocationTop) - // Single scroll container for entire tabs area - scrollableTabs := container.NewVScroll(tabs) + // Single fast scroll container for entire tabs area (2.5x speed) + scrollableTabs := ui.NewFastVScroll(tabs) return container.NewBorder(topBar, bottomBar, nil, nil, scrollableTabs) }