Open allcapsc opened 2 years ago
Thanks for opening this! Sounds annoying. You haven't mentioned what platform you're targeting. Happy to accept a PR.
Wouldn't the user-scalable=no
option in a meta viewport tag cover your use case?
Wouldn't the
user-scalable=no
option in a meta viewport tag cover your use case?
Unfortunately no, I also tried that but it does not stop pinch zoom on desktop rather mobile only.
Thanks for opening this! Sounds annoying. You haven't mentioned what platform you're targeting. Happy to accept a PR.
Currently targeting Windows, If I can find some info I'll try adding it onto here.
Unfortunately no, I also tried that but it does not stop pinch zoom on desktop rather mobile only.
Have you tried prevent default on various gesture events?
Should be pretty straight forward to be implemented for Windows: ICoreWebView2Settings5.IsPinchZoomEnabled
Couldn't yet find more information for macOS and Linux.
Any update on this? It is weird that one of my application has disabled zoom, but some are not. Not sure what I did in that app.
Updated: I used the vanilla template (back on Wails version 2.2.0) which disable the pinch zoom.
In the meantime, this method works for me in the front-end:
//Manually disable pinch zoom!
document.addEventListener("wheel", event => {
const { ctrlKey } = event;
if (ctrlKey) {
event.preventDefault();
return
}
}, { passive: false });
@KiddoV can you please provide more information about the difference between v2.2 and current regarding this? As far as I'm aware, we haven't ever supported this feature but there was a PR to manually set the scale of the viewport
TBH, that version is too old and I don't know what is the differences between those, but looking at my old application which using v2.2.0 and the vanilla template, hitting CTRL+Mouse Wheel
doesn't zoom in/out (I don't think I did something in the front-end back then) like other app which currently at the latest version/ svelte templates.
Any update on this? It is weird that one of my application has disabled zoom, but some are not. Not sure what I did in that app.
Updated: I used the vanilla template (back on Wails version 2.2.0) which disable the pinch zoom.
In the meantime, this method works for me in the front-end:
//Manually disable pinch zoom! document.addEventListener("wheel", event => { const { ctrlKey } = event; if (ctrlKey) { event.preventDefault(); return } }, { passive: false });
TYSM, this method works fine on me! 😃
Is your feature request related to a problem? Please describe.
I've been using Wails as an alternative for Electron but have noticed Wails doesn't support disabling Window Pinch or Mouse Scroll Zoom which can sometimes seem unprofessional when pushing an app to production. I would think this is a necessary feature for some people when wanting to limit control on an app window.
Describe the solution you'd like
I think it would be best for an option in the App Structure to Enable/Disable PinchZoom which would default to true and be edited to false to stop zooming entirely on an app window.
Describe alternatives you've considered
An alternative I tried was using CSS in the frontend but that doesn't do anything for limiting zoom pinch control on laptop touch-pads.
Additional context
No response