Touchpad gestures (pinching) does not work on macO...
# compose-desktop
n
Touchpad gestures (pinching) does not work on macOS (jvm build) - gives the following error albeit does not crash. I assume it is not implemented. Is it possible to know how can I override it?
d
Can you please make reproducible sample?
n
Sure @Dima Avdeev, I took example from official docs here: I want to make my box canvas to be zoomable/transformable like in android, but for desktop. I would assume touchbar woud behave same, but it gives error when I ran on Mac (I assume it is same on windows)
Copy code
@Composable
private fun TransformableSample() {
    // set up all transformation states
    var scale by remember { mutableStateOf(1f) }
    var rotation by remember { mutableStateOf(0f) }
    var offset by remember { mutableStateOf(Offset.Zero) }
    val state = rememberTransformableState { zoomChange, offsetChange, rotationChange ->
        scale *= zoomChange
        rotation += rotationChange
        offset += offsetChange
    }
    Box(
        Modifier
            // apply other transformations like rotation and zoom
            // on the pizza slice emoji
            .graphicsLayer(
                scaleX = scale,
                scaleY = scale,
                rotationZ = rotation,
                translationX = offset.x,
                translationY = offset.y
            )
            // add transformable to listen to multitouch transformation events
            // after offset
            .transformable(state = state)
            .background(Color.Blue)
            .fillMaxSize()
    )
}
d
I made a sample with your code, but I don't see error in logs https://github.com/dima-avdeev-jb/question-desktop-crash-touchpad/blob/d225c48adf781c7a6802ccf49cd272bdc9188345/src/main/kotlin/main.kt#L28 Can you please create a reproducible sample on GitHub ?
n
The errors happen when you pinch on mac touchpad. Are you sure you are not getting errors when doing that? If not, can you actually pinch-to-zoom ?
d
I am trying to do pinch-to-zoom, but nothing happens. This project shows error on your side?
n
Yes but it does not crash
d
Behavior is incorrect? Maybe you can record a video with description. I don't understand how to reproduce it.
n
Yes. I assume this is an openJDK problem, since it’s a JNI exception. I will play around with other JDKs, or kotlin/compose versions. If you don’t mind, I will text you in case and create separate repo some time later. Thanks!
This error is solved by using higher jdk. Thanks! @Dima Avdeev