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 a padding setter bug of ol.View when using useGeographic() #14531

Merged
merged 2 commits into from
Feb 26, 2023

Conversation

kikuchan
Copy link
Contributor

Setting padding of View instance after creation corrupts center coordinates when using useGeographic().

useGeographic();
const view = new View({
  center: [135, 35],
  zoom: 6,
});

const center = view.getCenter();
// [ 135, 34.999999999999986 ]

view.padding = [0, 0, 0, 0];

const point = view.getCenter();
// [ 0.001212725633561354, 0.0003144103494321371 ]

This should be center == point roughly because there is no change about the padding.

This PR fixes the bug, and includes a test for it.

@github-actions
Copy link

📦 Preview the website for this branch here: https://deploy-preview-14531--ol-site.netlify.app/.

Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

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

Thanks, @kikuchan.

@ahocevar ahocevar merged commit 34e4365 into openlayers:main Feb 26, 2023
@kikuchan kikuchan deleted the fix-padding-setter branch February 27, 2023 14:17
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

2 participants