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

Use bounds instead of center when zooming to Polyline/Polygon #1465

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

yohanboniface
Copy link
Member

Here is the initial issue:

  • when using defaultView=latest (means latest element of the default layer)
  • when map loads, we find the element, call getCenter to center the map on it
  • but Polygon/Polyline needs the element to be already on the map to call
    this method (at least because the map CRS is needed)

So while trying to fix that issue, I also found that using a centroid for
a complex geometry was not very friendly: the map zoom on a part of this
geometry, while it seems to be that it's better to have a full view of it.
Now that we highlight the selected element, it's also easier to get which
element is focused when there are a lot close one to the others.

We need the map bounds to compute the isOnScreen check
Here is the initial issue:
- when using defaultView=latest (means latest element of the default layer)
- when map loads, we find the element, call getCenter to center the map on it
- but Polygon/Polyline needs the element to be already on the map to call
  this method (at least because the map CRS is needed)

So while trying to fix that issue, I also found that using a centroid for
a complex geometry was not very friendly: the map zoom on a part of this
geometry, while it seems to be that it's better to have a full view of it.
Now that we highlight the selected element, it's also easier to get which
element is focused when there are a lot close one to the others.
@yohanboniface yohanboniface merged commit a32b680 into master Dec 15, 2023
12 checks passed
@yohanboniface yohanboniface deleted the defaultview-latest-path branch December 15, 2023 07:24
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