fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.1k stars 1.4k forks source link

[Mobile,Linux] Scrolling, by dragging, in widget.List list not working correctly #3522

Open emdete opened 1 year ago

emdete commented 1 year ago

Checklist

Describe the bug

if i enable -tags mobile the lists behave strange: while no item is selected, dragging works as extected.

after an item is selected the touch moves the selected item under the touch point. after that you cannot select a different item.

you can't even dragg more than a page because the currently selected item jumps under your finger giving you the same starting point always.

on a desktop computer (with mouse) it works as expected.

How to reproduce

compile a program with a list with -tags mobile

Screenshots

a video would be better here - if that would help let me know :)

Example code

package main

import (                 
        "fyne.io/fyne/v2"    
        "fyne.io/fyne/v2/app"      
        "fyne.io/fyne/v2/container"
        "fyne.io/fyne/v2/widget"
)

var data = []string{          
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
        "a", "string", "list",
}

func main() {             
        myApp := app.New()                       
        myWindow := myApp.NewWindow("Box Layout")
        myWindow.SetContent(container.NewBorder(
                nil, nil, nil, nil,
                widget.NewList(     
                        func() int {            
                                return len(data)
                        },
                        func() fyne.CanvasObject {
                                return widget.NewLabel("template")
                        },
                        func(i widget.ListItemID, o fyne.CanvasObject) {
                                o.(*widget.Label).SetText(data[i])
                        }),
                ))
        myWindow.ShowAndRun()
}

Fyne version

v2.3.0

Go compiler version

10.2.1

Operating system

Linux

Operating system version

buster/sid

Additional Information

this is on a Librem5

Jacalz commented 1 year ago

a video would be better here - if that would help let me know :)

A video would be nice :)

emdete commented 1 year ago

ok, just discovered: the effect is visible even if nothing is selected. additionally i discovered that dragging the scrollbar doesnt work in mobile mode.

additionally i found out that the mobile compiled version doesnt refresh the screen if the window needs repaint (after switching to another windows and back).

emdete commented 1 year ago

https://user-images.githubusercontent.com/3251523/210078263-a6e3d82e-44e8-4c05-bbcd-4904c078e916.mp4

andydotxyz commented 1 year ago

I cannot replicate this on iOS. Did you by any chance compile with wayland too, or any other tags that could impact the loaded driver?

emdete commented 1 year ago

wayland crashes on startup, no way to test there.

build command is go build -tags mobile ..

and yes, on my desktop it works just fine (besides the refresh behaviour).

the mobile in the video is a Librem5 which has wayland and xwayland running.

andydotxyz commented 1 year ago

Hmm, perhaps it is XWayland combined with Mobile. Or maybe it is XWayland on its own somehow.

and yes, on my desktop it works just fine (besides the refresh behaviour).

Is your desktop XWayland as well, or X11?

emdete commented 1 year ago

no, just X11. can i do something to investigate the case? any suggestions?

andydotxyz commented 1 year ago

Ah, I see now, it works to scroll down but not up. Perhaps the following helps for anyone looking at it:

"starting a new touch during drag on mobile linux will reset scroll to top".

andydotxyz commented 1 year ago

Even after the above realisation I cannot replicate on Mobile simulator (Darwin) or on iOS or Android devices so it does seem specific to Linux phone. Let's come back to it after this late running release.

andydotxyz commented 3 months ago

additionally i found out that the mobile compiled version doesnt refresh the screen if the window needs repaint (after switching to another windows and back).

This part at least should be fixed now :)