I am using compose Image as buttons, the images that I am displaying are all different kinds of shapes, and I am using .combinedClickable() on them like this:
Image(
bitmap = bitmap,
contentDescription = "",
modifier = Modifier.size(
(imageWidth * scaleX).pxToDp(),
(imageHeight * scaleY).pxToDp())
.aspectRatio(imageWidth / imageHeight)
.offset(location.x.pxToDp(), location.y.pxToDp())
.rotate(rotation)
.scale(image.scale)
.combinedClickable(
onClick = {
onClick.invoke()
appToOpen?.launch()
}, onLongClick = {
//appToOpen?.openSettings()
onLongClick()
}
))
For the most part, the bitmaps are not rectangles, one is the shape of a sun for example, with a large transparent background. I would like to make it so the combinedClickable is only triggered when the non-transparent part of the image is clicked.
Is there a way to achieve that in compose?