feat(ui): Add fast scroll with 2.5x speed multiplier
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
17765e484f
commit
8238870cc5
|
|
@ -440,6 +440,58 @@ func (r *droppableRenderer) Objects() []fyne.CanvasObject {
|
||||||
return []fyne.CanvasObject{r.content}
|
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
|
// DraggableVScroll creates a vertical scroll container with draggable track
|
||||||
type DraggableVScroll struct {
|
type DraggableVScroll struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
@ -524,7 +576,14 @@ func (d *DraggableVScroll) Tapped(ev *fyne.PointEvent) {
|
||||||
|
|
||||||
// Scrolled handles scroll events (mouse wheel)
|
// Scrolled handles scroll events (mouse wheel)
|
||||||
func (d *DraggableVScroll) Scrolled(ev *fyne.ScrollEvent) {
|
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 {
|
type draggableScrollRenderer struct {
|
||||||
|
|
|
||||||
8
main.go
8
main.go
|
|
@ -8479,11 +8479,9 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
// Wrap simple options with settings box at top
|
// Wrap simple options with settings box at top
|
||||||
simpleWithSettings := container.NewVBox(settingsBox, simpleOptions)
|
simpleWithSettings := container.NewVBox(settingsBox, simpleOptions)
|
||||||
|
|
||||||
// Both Simple and Advanced get their own scrolling
|
// Both Simple and Advanced get their own fast scrolling (2.5x speed)
|
||||||
simpleScrollBox := container.NewVScroll(simpleWithSettings)
|
simpleScrollBox := ui.NewFastVScroll(simpleWithSettings)
|
||||||
simpleScrollBox.SetMinSize(fyne.NewSize(0, 0))
|
advancedScrollBox := ui.NewFastVScroll(advancedOptions)
|
||||||
advancedScrollBox := container.NewVScroll(advancedOptions)
|
|
||||||
advancedScrollBox.SetMinSize(fyne.NewSize(0, 0))
|
|
||||||
|
|
||||||
if updateQualityVisibility != nil {
|
if updateQualityVisibility != nil {
|
||||||
updateQualityVisibility()
|
updateQualityVisibility()
|
||||||
|
|
|
||||||
|
|
@ -165,8 +165,8 @@ func buildSettingsView(state *appState) fyne.CanvasObject {
|
||||||
)
|
)
|
||||||
tabs.SetTabLocation(container.TabLocationTop)
|
tabs.SetTabLocation(container.TabLocationTop)
|
||||||
|
|
||||||
// Single scroll container for entire tabs area
|
// Single fast scroll container for entire tabs area (2.5x speed)
|
||||||
scrollableTabs := container.NewVScroll(tabs)
|
scrollableTabs := ui.NewFastVScroll(tabs)
|
||||||
|
|
||||||
return container.NewBorder(topBar, bottomBar, nil, nil, scrollableTabs)
|
return container.NewBorder(topBar, bottomBar, nil, nil, scrollableTabs)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user