Skip to content
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 new method to set layout-based zoom level limit #8041

Merged
merged 9 commits into from
Nov 22, 2016

Conversation

anaisbetts
Copy link
Contributor

@anaisbetts anaisbetts commented Nov 21, 2016

The current behavior of setZoomLevelLimits affects the visual-based zoom (i.e. no layout changes) despite all of the rest of the methods affecting layout-based zoom. While this zoom survives in-page navigations such as iframes being loaded, it also causes pages to be cut-off.

The ideal fix for this would to be to just change the behavior of this method but that would be a breaking change. This PR introduces a new zoom level limit method to limit layout-based zoom.

This allows you to work around #6958 by doing the following:

function setZoomHarder(wv, zoomLevel) {
  wv.setLayoutZoomLevelLimits(zoomLevel, zoomLevel);
  wv.setZoomLevel(zoomLevel);
}

Refs #6958

* `minimumLevel` Number
* `maximumLevel` Number

Sets the maximum and minimum layout-based (i.e. non-visual only) zoom level. In
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this change should be documented in

@kevinsawicki
Copy link
Contributor

kevinsawicki commented Nov 21, 2016

The ideal fix for this would to be to just change the behavior of this method but that would be a breaking change.

Any feels about changing the current method to accept a third type parameter so it could be something like?

wv.setZoomLevelLimits(0, 3, 'layout'); // new behavior
wv.setZoomLevelLimits(1, 2, 'visual'); // default behavior if unspecified

@anaisbetts
Copy link
Contributor Author

@kevinsawicki Feels a little weird to me but if you think it's better I'm okay with that

@kevinsawicki
Copy link
Contributor

kevinsawicki commented Nov 22, 2016

I pushed a few changes to this branch:

  • Expose and document setVisualZoomLeveLimits as public on webContents, webFrame, and <webview>
  • Map setZoomLevelLimits to SetVisualZoomLevelLimits for backwards compatibility
  • Add notes to planned-breaking-changes.md about setZoomLevelLimits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants