Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Disable zoom every time a display gets added or removed - #11345

Merged
as-cii merged 1 commit into
masterfrom
as-fix-pinch-to-zoom
Apr 1, 2016
Merged

as-cii merged 1 commit into
masterfrom
as-fix-pinch-to-zoom

Conversation

@as-cii

@as-cii as-cii commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

Fixes #8850. This continues the investigation started on #11326 and attempts to fix it using a different approach.

It turns out that the issue with pinch-to-zoom occurs only under certain circumstances; on my MacBook, it happens only whenever I do the following:

  1. Start Atom with my MacBook closed and my external monitor on;
  2. Open my Macbook, so that both displays are on;
  3. Try to pinch the tree-view;
  4. 💥

(The above never happens if my MacBook is open when Atom is launched)

As soon as a new display gets added or removed, in facts, the zoom level limit of the web frame is reset to the default and hence the page becomes zoomable again. This doesn't happen when changing the display's metrics (e.g. screen resolution), so I assume it must be something related to adding/removing displays. I have verified this arises also when enabling/disabling mirroring, which is considered by OS X as adding/removing one display.

Electron provides two events which allow us to detect when a display gets added or removed, so that we can reset the zoom level limits to (1, 1) every time this happens. I suspect this is what is happening in #8850, and this PR should fix it once for all.

/cc: @joshaber @nathansobo @mnquintana @atom/feedback for extra 👀 👀 👀.

@as-cii
as-cii force-pushed the as-fix-pinch-to-zoom branch from f709f08 to 793f5f9 Compare April 1, 2016 14:04
@joshaber

joshaber commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

Wow, good find 👍

@thomasjo

thomasjo commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

Awesome detective work! ❤️

@nathansobo

Copy link
Copy Markdown
Contributor

image

@mnquintana

Copy link
Copy Markdown
Contributor

I think we should report this to Electron too – I'm surprised that this resets after display changes. 😕

@as-cii
as-cii merged commit 4d52479 into master Apr 1, 2016
@as-cii
as-cii deleted the as-fix-pinch-to-zoom branch April 1, 2016 16:21
@as-cii

as-cii commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

@zcbenz: thoughts on what might be happening here?

@zcbenz

zcbenz commented Apr 7, 2016

Copy link
Copy Markdown
Contributor

@as-cii This surprised me too, I have no idea of why it happens.

as-cii pushed a commit that referenced this pull request Mar 7, 2017
This commit will register the `display-added` and `display-removed`
events only once in the main process in order to disable zoom (see
#11345) directly instead of
unnecessarily paying for I/O in the renderer process during startup.
as-cii pushed a commit that referenced this pull request Mar 7, 2017
This commit will register the `display-added` and `display-removed`
events only once in the main process in order to disable zoom (see
#11345) directly instead of
unnecessarily paying for I/O in the renderer process during startup.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Atom can be pinch and tap zoomed on OS X

6 participants