How could I prevent users from magnifying the website?
I'm trying to develop a React website app that could create designs for other websites. One existing website that I could find is Figma, and it has a fancy feature: users can't magnify its webpage using pinch movements on my Touchpad, which is really useful since the toolbars will always be there. Notice that I'm using a Mac computer instead of touch-screen devices.
Edit: I've already provided the feature to let users magnify the central page. (S:__% means scale here.) But when users try to magnify the page, I only want the central page to be magnified, and let those toolbars stay. Currently, when users magnify the page, the toolbars will also be magnified.
I've spent about 4 hours searching for how to implement this feature, but I still failed. Could anyone help me about this? I appreciate your time and effort! Thank you so much!
Things I've tried so far:
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
CSS:
html, body, #root, .app {
height: 100%;
width: 100%;
touch-action: pan-x pan-y;
}
window.addEventListener("resize", () => {console.log("...")});
document.body.addEventListener("transitionstart", ()=>{...});
/*
Listening to touchstart, touchend, touchmove events
(I'm not using touch screen devices so this doesn't work).
Monitoring dpi changes
(dpi doesn't change during magnification),
*/
Here's my app (it's still a prototype).
Here's my app after magnification (obviously I don't want users to do so).
Here's Figma's page. Magnification doesn't work on its page.