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

Improve typing and change StyleLayer query call interface #5276

Merged
merged 8 commits into from
Dec 31, 2024

Conversation

HarelM
Copy link
Collaborator

@HarelM HarelM commented Dec 29, 2024

Launch Checklist

This is a pure refactoring step to add more types to the query code flows.
It also add the globe projection matrix to be passed down to the style layers that needs it, but it doesn't solve any problems with exiting code (mainly circle layer).

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

Copy link

codecov bot commented Dec 29, 2024

Codecov Report

Attention: Patch coverage is 63.88889% with 52 lines in your changes missing coverage. Please review.

Project coverage is 91.83%. Comparing base (3d6d3f4) to head (fe404dc).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/data/feature_index.ts 34.78% 15 Missing ⚠️
...rc/style/style_layer/fill_extrusion_style_layer.ts 25.00% 9 Missing ⚠️
src/source/query_features.ts 86.53% 7 Missing ⚠️
src/style/style_layer/circle_style_layer.ts 30.00% 7 Missing ⚠️
src/style/style_layer/line_style_layer.ts 33.33% 6 Missing ⚠️
src/style/style_layer/fill_style_layer.ts 50.00% 4 Missing ⚠️
src/style/query_utils.ts 0.00% 2 Missing ⚠️
src/source/tile.ts 80.00% 1 Missing ⚠️
src/style/style.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5276      +/-   ##
==========================================
+ Coverage   91.81%   91.83%   +0.02%     
==========================================
  Files         282      282              
  Lines       38898    38908      +10     
  Branches     6825     6823       -2     
==========================================
+ Hits        35716    35733      +17     
+ Misses       3055     3047       -8     
- Partials      127      128       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HarelM
Copy link
Collaborator Author

HarelM commented Dec 29, 2024

I've done a very simple change in the position matrix that is passed to the queryIntersectsFeature of every layer.
This seems to still pass the tests.
I now see that there are missing tests for query stuff related to globe (test/integration/query).
I'm still not sure how to "see" what I'm writing in terms how to present on the map the intersection perimeter, so I'm still in very early stages of this fix.
Any help would be greatly appreciated.
Cc: @ibesora @kubapelc

@HarelM
Copy link
Collaborator Author

HarelM commented Dec 29, 2024

I was able to leverage the following method from the transform class:
projectTileCoordinates to project tile coordinates to screen coordinates, but I'm not sure it is a great solution.
image

In order to use it I need to pass down the tileID, which is not a big deal since the tile is the caller in this case, and it know its own ID.
I can check it in if this would help anyone to better understand what I did.
I think it is similar to @ibesora fix here: #5267, and it break the same way as this PR when adding circle-translate...

@HarelM
Copy link
Collaborator Author

HarelM commented Dec 29, 2024

Ignore my last comment, it breaks mercator related circle stuff...

@HarelM HarelM changed the title Fix circle query when using globe Improve typing and change StyleLayer query call interface Dec 30, 2024
@HarelM HarelM marked this pull request as ready for review December 30, 2024 12:06
@HarelM
Copy link
Collaborator Author

HarelM commented Dec 30, 2024

This is now ready for review, I'll add comments where I changed something that is not only types.

@HarelM HarelM requested review from ibesora and kubapelc December 30, 2024 12:07
src/source/query_features.ts Outdated Show resolved Hide resolved
@HarelM HarelM mentioned this pull request Dec 30, 2024
Copy link
Collaborator

@ibesora ibesora left a comment

Choose a reason for hiding this comment

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

Added a minor nit, otherwise this is a nice code improvement!

src/source/query_features.ts Outdated Show resolved Hide resolved
@HarelM
Copy link
Collaborator Author

HarelM commented Dec 31, 2024

The problem is that get projection data doesn't support passing unwrapped. I tried changing that but it didn't go well.
This part needs more work anyway, so I'll revert that and push only the type changes and minor refactoring ATM...

@HarelM HarelM enabled auto-merge (squash) December 31, 2024 12:07
@HarelM HarelM merged commit c2725d8 into main Dec 31, 2024
16 of 17 checks passed
@HarelM HarelM deleted the globe-circle-query-fix branch December 31, 2024 12: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.

2 participants