nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

nw13 MAC disable zoom

Open chino23 opened this issue 10 years ago • 17 comments

double tapping on mac with 2 fingers makes the view zoom in, which can be quite annoying, because it's unwanted. If the user does that accidentally, they might not know how to zoom out and then the app becomes unusable.

I've tried

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

but no effect

Is there a way to disable that?

chino23 avatar Jan 15 '16 05:01 chino23

Take a look: http://stackoverflow.com/questions/4389932/how-do-you-disable-viewport-zooming-on-mobile-safari http://apple.stackexchange.com/questions/107949/os-x-mavericks-disabling-smart-zoom-in-safari

However, this is expected platform behavior and more likely you may want to do some design/hint tweaks...

offshore avatar Jan 15 '16 06:01 offshore

Not every app has to implement zoom since zoom is not meant for every app. I can't double-tap to zoom in on iTunes or the native Notes app. Those Apple dev teams must have missed the "expected platform behavior" memo.

More to the point, a well-crafted NWJS app should not betray its origin: that is, a glorified browser app. Anymore than some other app should tell people it was coded in Objective-C or C++.

As such, the tap-to-zoom capability should be disabled by default and then an offered as an enabling option.

smr-el avatar Jan 16 '16 10:01 smr-el

Indeed. But it's proposed by mac platform, not by nwjs; that has to be taken into consideration. Have you finally solved that with meta viewport or not? I Don't have Mac within touch to check this out by myself.

offshore avatar Jan 18 '16 10:01 offshore

No, it doesn't have to be considered; not every app needs to implement the double tap zoom. Apple themselves have proven this with their own apps on their own platform.

Chromium the browser has implemented it to feature compete with Safari. But it doesn't have to. Since we're not making a browser but a desktop app that can arbitrarily at the discretion of the developer--that is, me--might have zoom but won't 99.99~% of the time. Therefore:

Zoom should be an option. That's defaulted off.


My app doesn't have this problem with or without the meta tag. But that might have something to do with the kind of app I've made. I'm just lending support to @chino23.

smr-el avatar Jan 18 '16 12:01 smr-el

So at last we came to just always not rely on default settings. Saying that it has to be taken into consideration I just wanted to say that for me, I thought an average mac developer should use to keep this feature in mind regardless developing with nwjs or any other means. However, again, it could be mentioned in docs to prevent this kind of questions in future.

offshore avatar Jan 18 '16 12:01 offshore

It's not even an option to disable right now. So some are forced to suffer preventable, application-breaking UX by an "feature" most people don't realize is OS-level and not Application-level.

With other OSX apps in other languages, you have to opt into the double-tap zoom by writing code allowing it to work. The event is a low-level catch by OSX to emit a special "double-tap-zoom" event instead what would otherwise be two consecutive taps. Much like how we don't have to bind to every click event, apps don't have to bind to this special event at all.

As I said last time, Chromium does; NWJS shouldn't. At least as a default.

smr-el avatar Jan 18 '16 14:01 smr-el

I agree with most people here, while it's nice to have, it should be turned off by default.

I just had a user test my app and he was suddenly "hey, what's that, it's all zoomed in now. how do I get it back?" he had to restart as he had no idea what he did with his fingers on the touchpad.

@rogerwang, any thoughts on this?

chino23 avatar Jan 19 '16 04:01 chino23

I'll look into this. Is there anyway to disable it in Chromium?

rogerwang avatar Jan 19 '16 04:01 rogerwang

I doubt it, haven't seen it.

chino23 avatar Jan 19 '16 05:01 chino23

@chino23 I might be related to an upstream issue https://code.google.com/p/chromium/issues/detail?id=378826

ghostoy avatar Jan 19 '16 12:01 ghostoy

@ghostoy I see... This seems to be around for quite a while and doesn't seem to get much attention though.

chino23 avatar Jan 20 '16 04:01 chino23

@chino23 is 'touch-action' style effective?

rogerwang avatar Jan 20 '16 06:01 rogerwang

putting touch-action: none; in html, body doesn't change anything.

chino23 avatar Jan 20 '16 06:01 chino23

@chino23 @rogerwang I have been able to disable the smart zoom. But since I followed the build instructions on nwjs.io, it appears I have the chromium.src repo, not this one. Plus I've only been in the code for about fifteen minutes so I don't know how to make the zoom a manifest option. Could use guidance on the matter.

smr-el avatar Jan 20 '16 11:01 smr-el

See the new doc here: http://docs.nwjs.io/en/latest/References/Manifest%20Format/#double_tap_to_zoom_enabled

rogerwang avatar Jan 23 '16 00:01 rogerwang

oh nice, Roger! Thanks. Great to see it disabled by default.

I'll check it out!

By the way, gotta say it, the new docs are so beautiful, it's so much fun to read it all. Well done.

chino23 avatar Jan 23 '16 01:01 chino23

Just tested beta 5 and it works great! Thanks a lot Roger!

chino23 avatar Feb 01 '16 10:02 chino23