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

Pinch zoom does not work on Android WebView #2258

Closed
mhsmith opened this issue Dec 4, 2023 · 4 comments
Closed

Pinch zoom does not work on Android WebView #2258

mhsmith opened this issue Dec 4, 2023 · 4 comments
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.

Comments

@mhsmith
Copy link
Member

mhsmith commented Dec 4, 2023

Originally posted by @t-arn on Discord

Is it possible to use the 2-finger-gesture to zoom a WebView content on Android? Yesterday, I suddenly had this working, but I don't know why it worked then. Because now, it does not work anymore and I didn't really change anything in that area.

It has to do with the screen orientation. Switching several times between portrait and landscape makes the zoom work. But where is the logic? I would like to have the zooming always active...

[...]

I found the solution. The following code enables pinch zoom on Android:

webview._impl.native.getSettings().setBuiltInZoomControls(True)
webview._impl.native.getSettings().setDisplayZoomControls(False)

I don't know why it sometimes works without this code.
Should we add this to the Android implementation of WebView?


Originally posted by @freakboy3742 on Discord

I haven’t dug into the specifics enough to know if there are other consequences, but on the face of it, it seems like a reasonable change.

@mhsmith mhsmith added bug A crash or error in behavior. android The issue relates to Android mobile support. labels Dec 4, 2023
@mhsmith
Copy link
Member Author

mhsmith commented Dec 4, 2023

Yes, this looks reasonable to me too.

@t-arn
Copy link
Contributor

t-arn commented Dec 4, 2023

I will make a PR tomorrow.

@t-arn
Copy link
Contributor

t-arn commented Jan 11, 2024

@mhsmith We can close this issue since it has been solved with PR #2261

@mhsmith
Copy link
Member Author

mhsmith commented Jan 11, 2024

Thanks; in future, you can link a PR to an issue automatically by adding text like "closes #2258" somewhere in the PR's first comment.

@mhsmith mhsmith closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.
Projects
None yet
Development

No branches or pull requests

2 participants