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

region picker centering fixes #40

Merged
merged 3 commits into from
Jun 11, 2024
Merged

region picker centering fixes #40

merged 3 commits into from
Jun 11, 2024

Conversation

Shane98c
Copy link
Member

@Shane98c Shane98c commented Jun 10, 2024

The original problem we were seeing was caused by an overly strict maps coordinate check which wasn't happy with longitude values > 180 that was fixed here: carbonplan/maps#117

Next I noticed that sometimes there were still issues when the same polygon is visible twice on the map (often behind the sidebar) the region picker would sometimes end up on the hidden polygon. To fix this, I went with a simplifying approach - instead of using an exact centroid (which sometimes had the 'wrong' longitude), we're now just using the click coordinates as our center. So now the picker will always show up on the instance of the polygon that was clicked.

If for whatever reason they've navigated/zoomed to a location where the center is not visible, we fly the map there when we initialize the region picker.

Copy link

vercel bot commented Jun 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oae-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 4:42pm

Copy link
Member

@katamartin katamartin left a comment

Choose a reason for hiding this comment

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

This generally looks good to me!

Two questions:

  • Should we clear selectedRegionCenter when the region is cleared?
  • Related to above, selectedRegionCenter is never set when a region is selected from the time series. It might make sense to tackle in separate PR, but any thoughts on how to handle that case?

Copy link
Member

@katamartin katamartin left a comment

Choose a reason for hiding this comment

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

lgtm!

@Shane98c
Copy link
Member Author

thanks! I'm working on a pattern for setting the center / flying to the polygon on the map when selected from the graph, but I'll put that in a separate PR so we can get this merged!

@Shane98c Shane98c merged commit 710c5b1 into main Jun 11, 2024
2 checks passed
@Shane98c Shane98c deleted the region-picker-fixes branch June 11, 2024 17:20
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.

2 participants