fyne-io / fyne

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

Annoying select problem for list or tree widget #3182

Open gralech opened 2 years ago

gralech commented 2 years ago

Checklist

Describe the bug

List and tree nodes not selected, if mouse moved after click Very annoying behaviour, sometimes items just not get selected I have to use button widget instead, wich have no this problem

How to reproduce

  1. create tree or list widget
  2. mouse click element and hold
  3. move mouse a bit
  4. release mouse
  5. item not selected

Screenshots

No response

Example code

package main

//__

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

//__

var content fyne.Container var tree widget.Tree var list map[string][]string

//__

func main() { myApp := app.New() myWindow := myApp.NewWindow("List") makeTree() top := widget.NewLabel("Items' list::") bottom := widget.NewButton("Update list", nil) content = container.New(layout.NewBorderLayout(top, bottom, nil, nil), top, tree, bottom, )

myWindow.SetContent(content)
myWindow.Resize(fyne.NewSize(480, 600))
myWindow.ShowAndRun()

}

//__

func makeTree() { list = map[string][]string{ "": {"A"}, "A": {"B", "D"}, "B": {"C"}, "C": {"abc"}, "D": {"E"}, "E": {"F", "G"}, }

tree = widget.NewTreeWithStrings(list)
tree.OnSelected = func(id string) {
    log.Println("Tree node selected: ", id)
}
tree.OnUnselected = func(id string) {
    log.Println("Tree node unselected: ", id)
}

tree.OpenAllBranches()

}

Fyne version

2.2.3

Go compiler version

1.18

Operating system

Windows

Operating system version

Windows 10

Additional Information

No response

andydotxyz commented 2 years ago

How much movement is "a bit"? at some point a tap has to become a drag event. We already support a move of 2pt to try and compensate for this.

gralech commented 2 years ago

hard to measure, obviously it's more than 2pt is it possible to disable completely drag? or increase 2pt compensation?

andydotxyz commented 2 years ago

is it possible to disable completely drag?

If you do that then scrolling on mobile will break wont it? The 2 could be increased... but that removes precision for apps that care. For example if you have HiDPi (2 scale) and want to drag an item a short distance 5px is currently the smallest (2dp2 + 1). A reasonable minimum. If you double it then a drag operation won't start until 9px have been covered.

If you can describe why this will improve the UX we can review, but on the face of it I don't think the tradeoff would be worth it.

gralech commented 2 years ago

There will be no mobile version, so UX about mouse clicks in my case. Like i said, sometimes when i try to fast click UI element, it won't clicked. I understand, why this happens, but it very annoying. Is there a way to disable drag for my app only? Or to increase compensation?

andydotxyz commented 2 years ago

There will be no mobile version, so UX about mouse clicks in my case

I understand that for your app it may not matter, but our standard widgets all have to work on all platforms, so we don't offer tweaks that will break them on some platforms.

Or to increase compensation?

This is a tricky one, it is at the driver level so increasing in one place to avoid a drag issue makes other desired drags much less responsive.