-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to support touchscreen? #1555
Comments
I see Modifier extensions function has a mouseScroll and mouseTouch,How to use it ? Thx~ |
Hi @akurasov, Do you know how to solve this problem? I saw that you mentioned relevant problems and tried, but I still can't solve the problem of dragging and scrolling on the touch screen. |
val scrollState = rememberLazyListState()
val data = (0 until 1000).map { "Item $it" }
LazyColumn(
modifier = Modifier.draggable(rememberDraggableState { delta ->
println("delta=$delta")
runBlocking {
scrollState.scrollBy(-delta)
}
}, orientation = Orientation.Vertical),
state = scrollState
) {
items(data) { i ->
Text(
i,
Modifier
.padding(14.dp)
.fillMaxWidth()
)
}
} See above code: |
Yes, if you want to handle dragging gesture, you should use this API. There is no explicit touch screen support, Compose relies on OS level conversion of touch Screen events to mouse events. |
Is there a plan to implement proper touch screen support? I actually attempted to pass through touch events while trying out compose, using the |
There are no immediate plans for it. Could you please describe some scenarios, where current support is not enough? |
There's no fling behaviour when scrolling with the above method, and no way to differentiate between mouse and touch gestures. |
My use case is a GUI client that includes 2D and 3D mapping functionality. It can be run on any Windows or Linux multitouch-enabled device. Examples include laptops and desktops with monitors having multitouch support, Microsoft Surface and Linux tablet devices, and similar. For 2D maps (think Google Maps) it supports simultaneous pinch-to-zoom, drag-to-pan, and twist-to-rotate two-finger gestures. For 3D maps (think Google Earth) it's the same, with the addition that switching to three-fingered gestures changes drag-to-pan to drag-to-pan-horizontally-and-tilt-vertically. The client can sometimes be used in high-criticality (i.e. potential loss of life) situations, so precise, performant touch and gesture control is vital. Currently we use OpenJFX for this, in particular its I'd like to consider porting to Compose Multiplatform in the future to support Windows and Linux desktop, Android, and WASM targets all from a single client, but multitouch support would be required for each. I could also see gaming and 3D modelling applications being two other use cases. |
I have a window pad,I running app on that,App is very simple just a LazyColumn,It can use mouse wheel scroll,but not use touchscreen scroll.
The text was updated successfully, but these errors were encountered: