Skip to content

Gesture Behavior Override in EnhancedZoom Modifier #7

@Ten-Wang

Description

@Ten-Wang

Hello,

I'm using the library code as shown below:

AsyncImage(
        model = imageRequest,
        imageLoader = imageLoader,
        modifier = modifier.enhancedZoom(
            key = "zoomable",
            clip = true,
            enhancedZoomState = rememberEnhancedZoomState(
                minZoom = .5f,
                maxZoom = 10f,
                imageSize = IntSize(imageWidth, imageHeight),
                limitPan = false,
                moveToBounds = true,
            ),
            zoomOnDoubleTap = { zoomLevel: ZoomLevel ->
                println("zoomOnDoubleTap")
                when (zoomLevel) {
                    ZoomLevel.Mid -> 3f
                    ZoomLevel.Min -> 1f
                    ZoomLevel.Max -> 5f
                }
            },
            enabled = { zoom, pan, rotation ->
                zoom > 1f
            }
        ).pointerInput("zoomable") {
            detectTapGestures(
                onTap = { println("onTap") },
                onDoubleTap = { println("onDoubleTap") },
                onLongPress = { println("onLongPress") })
        },
    )

However, I've noticed that using detectTapGestures seems to override the gesture behavior defined in zoomOnDoubleTap. Interestingly, when I use another library (https://github.com/usuiat/Zoomable), I don't encounter this issue. Upon inspecting their source code, I found that they override the behavior of PointerInputScope.detectTransformGestures (https://github.com/usuiat/Zoomable/blob/main/zoomable/src/main/java/net/engawapg/lib/zoomable/Zoomable.kt). Is there a way to ensure that gesture behavior is not overridden in this library?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions