Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gesture Behavior Override in EnhancedZoom Modifier #7

Open
Ten-Wang opened this issue Oct 13, 2023 · 0 comments
Open

Gesture Behavior Override in EnhancedZoom Modifier #7

Ten-Wang opened this issue Oct 13, 2023 · 0 comments

Comments

@Ten-Wang
Copy link

Ten-Wang commented Oct 13, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant