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

Fix zoom after export to PDF is done #9237

Merged
merged 5 commits into from Feb 19, 2019
Merged

Fix zoom after export to PDF is done #9237

merged 5 commits into from Feb 19, 2019

Conversation

umbe1987
Copy link
Contributor

This should fix #9235

@@ -64,6 +65,7 @@ exportButton.addEventListener('click', function() {
// Reset original map size
map.setSize(size);
map.getView().fit(extent, {size});
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be enough to just change this line to

map.getView().fit(extent, {
  size: size,
  constrainResolution: false
});

Then you could remove the rest of the changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally right. Just provided your suggestion in the commit. Thanks.

@ahocevar
Copy link
Member

If you format your code like in the snippet I provided, the CI will be happy. You can also test locally by running npm run lint.

@umbe1987
Copy link
Contributor Author

If you format your code like in the snippet I provided, the CI will be happy. You can also test locally by running npm run lint.

Just did it, thanks for making me discover lint!

@ahocevar
Copy link
Member

Thanks @umbe1987.

@ahocevar ahocevar merged commit 84995c6 into openlayers:master Feb 19, 2019
@umbe1987 umbe1987 deleted the export-to-pdf-example branch February 19, 2019 10:51
@umbe1987
Copy link
Contributor Author

With pleasure ;)

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.

Export PDF examples sometimes does not reset map extend and zoom
2 participants