New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zoomToPageWidth window option #7776

Merged
merged 8 commits into from Nov 21, 2016

Conversation

Projects
None yet
2 participants
@kevinsawicki
Contributor

kevinsawicki commented Oct 27, 2016

This pull request adds support for a zoomToPageWidth window option (defaults to false) that changes the macOS zoom behavior to use the preferred width of the page instead of zooming to to the full width of the screen.

This allows apps to opt-in to a more "native" feeling zoom behavior where their windows grow the full height of the screen but only expands to the needed width, such as the how the Finder handles zoom.

This was inspired by Chrome's implementation of this in chrome/browser/ui/cocoa/browser_window_controller.mm.

Current behavior

zoom-before

New behavior with zoomToPageWidth set to true

zoom-after

/cc @dgraham

@kevinsawicki

This comment has been minimized.

Show comment
Hide comment
@kevinsawicki

kevinsawicki Nov 1, 2016

Contributor

@bengotow wanted to get your opinion on this change. Do you think this option is worth having in there? Do you think N1 would possibly use it?

Contributor

kevinsawicki commented Nov 1, 2016

@bengotow wanted to get your opinion on this change. Do you think this option is worth having in there? Do you think N1 would possibly use it?

@bengotow

This comment has been minimized.

Show comment
Hide comment
@bengotow

bengotow Nov 17, 2016

Contributor

This looks great to me - I think it'd definitely be useful for N1. We have a few window types (like the email composer) that really shouldn't be more than 800px wide or so, and it'd be nice for maximizing to stop there.

Also 👍 for handling the shift-option-click scenario... that's some seriously obscure Mac foo.

Could we add a note to the docs to mention how the page width is determined? I'm actually not sure how Chrome computes the intrinsic width of the document.

Contributor

bengotow commented Nov 17, 2016

This looks great to me - I think it'd definitely be useful for N1. We have a few window types (like the email composer) that really shouldn't be more than 800px wide or so, and it'd be nice for maximizing to stop there.

Also 👍 for handling the shift-option-click scenario... that's some seriously obscure Mac foo.

Could we add a note to the docs to mention how the page width is determined? I'm actually not sure how Chrome computes the intrinsic width of the document.

@kevinsawicki

This comment has been minimized.

Show comment
Hide comment
@kevinsawicki

kevinsawicki Nov 17, 2016

Contributor

I'm actually not sure how Chrome computes the intrinsic width of the document.

To be honest I'm not sure of this either, will look deeper into Chrome for details.

Contributor

kevinsawicki commented Nov 17, 2016

I'm actually not sure how Chrome computes the intrinsic width of the document.

To be honest I'm not sure of this either, will look deeper into Chrome for details.

@kevinsawicki kevinsawicki merged commit 2e35b1c into master Nov 21, 2016

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
electron-linux-arm Build #4745140 succeeded in 70s
Details
electron-linux-ia32 Build #4745141 succeeded in 64s
Details
electron-linux-x64 Build #4745142 succeeded in 128s
Details
electron-mas-x64 Build #2860 succeeded in 8 min 8 sec
Details
electron-osx-x64 Build #2871 succeeded in 7 min 30 sec
Details
electron-win-ia32 Build #1934 succeeded in 10 min
Details
electron-win-x64 Build #1905 succeeded in 10 min
Details

@kevinsawicki kevinsawicki deleted the zoom-to-web-contents-size branch Nov 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment