Viewport scrolling not possible in tablet mode

Hi,

there’s a problem affecting viewports and other custom components on Windows when in tablet mode – i.e. using touch instead of a mouse.

When in tablet mode, a Viewport can’t be scrolled because setScrollOnDragEnabled is enabled at compile time only for Android and iOS.

We have also other custom components that rely on dragging when in touch mode (iOS and Windows tablets).

So one solution would be checking the isTabletModeActivatedForWindow(), which is private at the moment, or even better wrap it in a generic method ( something like isTouchEnabled()) in the ComponentPeer.

What do you think?

Thanks,
Matteo

1 Like

Checking the input type of the main mouse source is probably the best way to do this instead of adding a method to the peer:

Desktop::getInstance().getMainMouseSource().isTouch()

I’ll add this check to the Viewport constructor too so drag-to-scroll is enabled by default on all touch devices.

1 Like