JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.03k stars 1.16k forks source link

Enhancement(web): Support onDrag/detectDragGestures Modifier on Web Platform #4493

Closed whitescent closed 1 week ago

whitescent commented 6 months ago

It seems that onDrag/pointerInput detectDragGestures doesn't work with Web Platform, here's a simple example

var offset by remember { mutableStateOf(Offset.Zero) }
Image(
  painter = painterResource(Res.drawable.logo),
  contentDescription = null,
  modifier = Modifier.offset {
    IntOffset(offset.x.toInt(), offset.y.toInt())
  }
    .size(48.dp)
    .pointerInput(Unit) {
      detectDragGestures(
        matcher = PointerMatcher.Primary
      ) {
        offset += it
      }
    }
)
eymar commented 6 months ago

Thanks for reporting! It's rather a bug, since it's available for using it in the code but it doesn't work as expected :) The feature was not implemented internally yet.

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.