onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 301 forks source link

Disable MacOS double tap zoom/enable cmd-plus font resizing #1096

Open akinsho opened 6 years ago

akinsho commented 6 years ago

@bryphe, before jumping in with another issue just wanted to say that Oni is looking sooo much nicer in such a small space of time, I 😍 😍 the file type icon functionality and upcoming sidebar.

On to the issue, double tapping with two fingers on MacOS (possibly also on windows, I don't have a windows machine so I'm not sure) causes Oni to zoom in which I think is something that macOS adds like pinch to zoom etc.

In keeping with trying to give Oni a more native app feel the effect is visually not ideal as the text looks blown up and is something that other editors such as atom and vscode seem to have circumvented.

I've tried remedying this using the solutions posted here (an issue posted on the electron repo) however this doesn't seem to be able stop this behaviour. Arguably a minor problem in the grand scheme of things but as a mac user who occasionally double taps by mistake its very disconcerting/annoying.

I've noticed that cmd-+ and cmd- - do not cause the font to scale which I think is native functionality on mac os which might have been removed in oni so I wonder if you might have some insight into how to stop this. Also if not intentionally removed, I think the command plus and minus are actually quite useful when showing code, and think it might be preferable to keep that functionality whilst disabling the double tapping, I'm happy to continue looking at this but wonder if you've previously dealt with something similar in oni

CrossR commented 6 years ago

I can't talk on the Tap to zoom, but I know that zoom keybinds has been discussed before in #840. Using the work around in there, you can get temporary zoom, but Oni will need a way of saving config options if we want it to save that and persist over closing Oni.

Once we have a way to save values back, it should be a lot easier so people can bind increasing the font size instead of the zoom level, as zoom level causes both editor and ui fonts to increase in size, and causes some graphical issues with the scroll bar.

bryphe commented 6 years ago

@bryphe, before jumping in with another issue just wanted to say that Oni is looking sooo much nicer in such a small space of time, I 😍 😍 the file type icon functionality and upcoming sidebar.

That's awesome to hear, thanks πŸ˜„ I'm hoping the days of having to choose between a first-class vim experience and a modern UX are numbered...

On to the issue, double tapping with two fingers on MacOS (possibly also on windows, I don't have a windows machine so I'm not sure) causes Oni to zoom in which I think is something that macOS adds like pinch to zoom etc.

Interesting, nice catch! Unfortunately I don't have a Macbook to test this on - but I believe this is specific browser functionality. Definitely another one of those issues we have that breaks the immersion of Oni being an 'app' and the browser behavior is surfaced...

I wonder if the info in this stack overflow post is applicable? https://stackoverflow.com/questions/10614481/disable-double-tap-zoom-option-in-browser-on-touch-devices

Specifically, setting this <meta> tag may address the issue:

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

If we add it to the <head> in our index.html at the root.

Regarding the cmd-+ and cmd- - bindings, agree with both you & @CrossR - makes sense to have the key bindings, and suppress the double-tap behavior. We can track this in #840 .

I'd like to investigate some saving/persisting config options next week, so that we can start taking on some of those features that depend on it (#840, #355 for the background color, etc).

akinsho commented 6 years ago

@bryphe @CrossR thanks for the info, I had a look at the previous issue (#840) , with regards to that I think increasing the font size sounds good, as opposed to increasing the zoom level as the results are not pretty, It'd be interesting to have things persist, out of interest would this be writing to a user's config file, or saving the previous value to local storage like redux persist

Re the meta tag solution to the double tap, and actually pinching to zoom which I discovered I could do changing the meta tag unfortunately doesn't work. I think maybe with each iteration of macOS electron are having to re-jig the way they stop the zoom so the current solution doesn't work or i've implemented it wrongly, I'll post on the thread in the electron repo and see if there's a new solution.