Translations: 简体中文
Tip
- The following example takes precedence over the Compose version component for demonstration
- ZoomState.zoomable is equivalent to ZoomImageView.zoomable
- ZoomState.subsampling is equivalent to ZoomImageView.subsampling
ZoomImage needs to receive double-click events, so it has to intercept click and long press events, and you can receive both events through the provided interface
compose:
SketchZoomAsyncImage(
imageUri = "https://sample.com/sample.jpeg",
contentDescription = "view image",
modifier = Modifier.fillMaxSize(),
onTap = { touch: Offset ->
// Click Events
},
onLongPress = { touch: Offset ->
// Long press event
},
)
view:
View's setOnClickListener and setOnLongClickListener methods are still available Additional OnViewTapListener and OnViewLongPressListener interfaces with touch location are provided
val sketchZoomImageView = SketchZoomImageView(context)
sketchZoomImageView.onViewTapListener = { view: android.view.View, x: Float, y: Float ->
// Click Events
}
sketchZoomImageView.onViewLongPressListener = { view: android.view.View, x: Float, y: Float ->
// Long press event
}