Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbar in general not working with touchscreen #347

Closed
yagui opened this issue May 24, 2021 · 12 comments
Closed

Scrollbar in general not working with touchscreen #347

yagui opened this issue May 24, 2021 · 12 comments
Labels

Comments

@yagui
Copy link

yagui commented May 24, 2021

Environment information
Describe your environment information, such as:

  • SO: linux/Raspberry OS
  • python version: v3.7
  • pygame version: v2.0.1
  • pygame-menu version: v4.0.7-master

Describe the bug
Scroll bar doesn't respond to touch on the screen. I can't drag the slider from the scroll bar. At some point I try to touch lower in the scroll bar to see if at least I can go down not dragging but jumping to the lower section (I don't know if this make sense), but it also doesn't work. Same test in the computer with the mouse works perfectly. When I try to slide the scroll bar, it seems to gets selected because it changes color, but nothing happen.

To Reproduce
I copied the scroll_menu example and added touchscreen=True in all menus. The result is I can select buttons, go inside other menu and go back with the X, but scroll bar doesn't respond to touchs.
video2

@yagui yagui added the bug label May 24, 2021
@yagui
Copy link
Author

yagui commented May 24, 2021

I can try to log all pygame events if that helps you to track the bug, or if you want send me a script to test and I'll run it. Thank you

@ppizarror
Copy link
Owner

It's strange because I cannot reproduce that using an touch emulator. Can you print the events list read by Scrollbar.update, that is, printing the list within

https://github.com/ppizarror/pygame-menu/blob/master/pygame_menu/widgets/widget/scrollbar.py#L520-L526

That would give me an idea about what events are being processed by the menu

@ppizarror
Copy link
Owner

@anxuae hi! Do you experience touchscreen issues regarding scrolling?

@yagui
Copy link
Author

yagui commented May 24, 2021

Using the scroll_menu.py example, adding touchscreen = True to all menus and changing windows size to (800,480).

video3
log.txt

@yagui
Copy link
Author

yagui commented May 24, 2021

I'm seeing that there are no check for FINGERUP/DOWN/MOTION in that method. Could that be the problem?
Also, I didn't added in this example, but in my application I use mouse_enabled=False and I see most of these conditions are going to evaluate False

@ppizarror
Copy link
Owner

ppizarror commented May 24, 2021

Yes, you're right. Even the scrollbars do not consider the same configurations as the menu. I do not know how I've missed that

sbar.set_controls(joystick=False)

I'll push a PR asap

@ppizarror
Copy link
Owner

Hi, #349 fixes this issue. However, the solution is far from perfect as the amount of scrolled "dx, dy" is not consistent across different scroll surfaces. I had to figure out the correct maths

@ppizarror
Copy link
Owner

I think I've found a better solution, and it was considering the dx, dy are within range (-1, 1), thus, 2*window_size must be applied. Let me know if the PR's solves the issue

@yagui
Copy link
Author

yagui commented May 25, 2021

It's working great now for the scroll_menu example, but the scroll in the dropselect or multiselect is still not working (I merged both pull request to test it).

@ppizarror
Copy link
Owner

Hi! I've found what was bad in PR. The Frame's ScrollArea object (which includes the ScrollBar widgets) was not properly configured (both menu - for scrolling, and controls settings). Also, the frame did not configure the menu reference for the scrollarea while calling make_scrollarea method.

I've committed to #349. Let me know about anything! 😎

@yagui
Copy link
Author

yagui commented May 25, 2021

Working smoothly now! Thanks!!

@ppizarror
Copy link
Owner

Excellent, I'll push the new version on the weekend. Please open any other issue if I'd encounter any issue =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants