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

The zoom on the Desktop does not work correctly #125

Open
GpixelProg opened this issue Jan 4, 2025 · 4 comments
Open

The zoom on the Desktop does not work correctly #125

GpixelProg opened this issue Jan 4, 2025 · 4 comments

Comments

@GpixelProg
Copy link

Hello, I have created a test desktop project in which I added an image with Modifier.zoomable() as described in the documentation. When using the touchpad and mouse, I get the result on the video. Maybe I'm doing something wrong, or it's a bug.

OS: Mac OS Sequoia, M1

I would be grateful for an answer.

Screen.Recording.2025-01-04.at.09.20.03.mov
fun main() = application {
    Window(
        title = "ZoomTest",
        state = rememberWindowState(width = 800.dp, height = 600.dp),
        onCloseRequest = ::exitApplication,
    ) {
        window.minimumSize = Dimension(350, 600)

        val focusRequester = remember { FocusRequester() }
        val painter = painterResource(Res.drawable.image)

        val zoomableState = rememberZoomableState(
            zoomSpec = ZoomSpec(
            ),
        ).apply {
            setContentLocation(
                ZoomableContentLocation.scaledInsideAndCenterAligned(painter.intrinsicSize)
            )
        }

        LaunchedEffect(Unit) {
            focusRequester.requestFocus()
        }

        Image(
            modifier = Modifier
                .fillMaxSize()
                .background(Color.Yellow)
                .focusRequester(focusRequester)
                .zoomable(zoomableState),
            painter = painter,
            contentDescription = null,
            contentScale = ContentScale.Inside,
            alignment = Alignment.Center,
        )
    }
}
@saket
Copy link
Owner

saket commented Jan 4, 2025

This is possibly due to https://youtrack.jetbrains.com/issue/CMP-2209.

Could you place a debugger breakpoint here to see what values of zoomChange you're seeing from your touchpad?

@GpixelProg
Copy link
Author

Screenshot 2025-01-04 Screenshot 2025-01-04 Screenshot 2025-01-04 Screenshot 2025-01-04 Screenshot 2025-01-04

With a slight movement on the touchpad, the value and zoom reaches 1, and then gradually decreases on its own

@GpixelProg
Copy link
Author

When zooming out on the touchpad
Screenshot 2025-01-04 at 21 11 46
Screenshot 2025-01-04 at 21 13 28
Screenshot 2025-01-04 at 21 13 41

@saket
Copy link
Owner

saket commented Jan 4, 2025

Yeah that doesn't look good. I might have to disable pinch to zoom on desktop until the issue is resolved.

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

2 participants