Questions tagged [android-jetpack-compose-gesture]

8 questions
26
votes
4 answers

How can I get onTouchEvent in Jetpack Compose?

In normal view, we can have onTouchEvent override fun onTouchEvent(event: MotionEvent?): Boolean { when (event?.action) { MotionEvent.ACTION_DOWN -> {} MotionEvent.ACTION_MOVE -> {} …
Elye
  • 53,639
  • 54
  • 212
  • 474
10
votes
7 answers

Detect swipe direction on Jetpack Compose

I'm trying to detect swipe direction in Compose. I'm using the draggable modifier for this. But draggable allows only one direction to detect (Vertical or Horizontal). I want to detect swipes for all directions (left, right, up, down). Can anyone…
6
votes
0 answers

How to have natural pan and zoom with Modifier.graphicsLayer{}.pointerInput()?

This is not the duplicate of using Modifier.graphicsLayer{} to rotate or pan Image. I want move, rotate and scale a Composable on screen not in a stationary position. What i want to achieve is as in this image Order of Modifier.graphicsLayer{} and…
Thracian
  • 43,021
  • 16
  • 133
  • 222
5
votes
1 answer

Jetpack Compose Intercept pinch/zoom in child layout

I want to have a box with colums of rows filled with further children that accept clicks ("CL") and long clicks ("LO") to be zoomable and draggable. Using pointerInput with detectTransforgestures I can transform the child layout as I want. var zoom…
3
votes
3 answers

Detect when the user stops pressing the button Jetpack Compose

I have a button and I want it to execute an action only while it is long pressed. I am able to execute the action on the long press already, the problem is I do not know how to stop it once the user is no longer pressing down on the button. 1)How…
2
votes
1 answer

How to constraint an image panning to the edges of the Box in Jetpack Compose?

How to constraint an image panning to the edges of the Box in Compose? I'm using pointerInput(Unit) { detectTransformGestures { centroid, pan, zoom, rotation -> }} to control zooming and panning. I'm solving this panning problem when the image is…
2
votes
1 answer

Transformables with fling?

I am trying to implement a composable which allows the user to drag and zoom an image. It seems that the most natural way to implement this is by using the pointerInput or transformable modifiers. However, both do not seem to support fling. If I try…
1
vote
1 answer

Set limits for pan in jetpack compose

I am having hard times while trying to implement pan gesture with jetpack compose. My requirement is pan gesture to not move loaded image out of its original boundaries. Is that possible? @Composable fun ZoomableImage() { val bitmapBytes =…