-
-
Notifications
You must be signed in to change notification settings - Fork 848
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
Update ShapeSource methods to make it usable with any cluster #1499
Update ShapeSource methods to make it usable with any cluster #1499
Conversation
…ShapeSource source data
@tr3v3r Thanks for the PR 👍 looks nice. One issue could be backward compatibility. What do you think?! |
@mfazekas thanks for quick response! |
@mfazekas Also, I think we can add a comment/warning that cluster_id arg. is deprecated and will be removed in version 9+. What do you think? |
@mfazekas PR updated. Instead of adding some if / else statement inside native methods to detect the type of an argument I've just copied prev. methods implementation to reduce the number of possible bugs and make easier the process of removing this functionality in the future. If we merge this I also provide PR that deletes deprecated functionality for release 9+. Thanks for your time ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tr3v3r thanks this looks great to me, there are some notes in the review, otherwise it looks great to go!
Thanks for the nice work! 👍
android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.java
Outdated
Show resolved
Hide resolved
android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.java
Show resolved
Hide resolved
…om === -1, add check if mSorce exists on Android
thanks 🙇🏿 |
…ox#1499) * Update ShapeSource methods to make it usable with any cluster within ShapeSource source data * Get back possibility to pass cluster_id as argument for backward compatibility * Add more description into changelog, get rid of redundant check of zoom === -1, add check if mSorce exists on Android * Fix description text
…ox#1499) * Update ShapeSource methods to make it usable with any cluster within ShapeSource source data * Get back possibility to pass cluster_id as argument for backward compatibility * Add more description into changelog, get rid of redundant check of zoom === -1, add check if mSorce exists on Android * Fix description text
Description
Since current implementation of
getClusterExpansionZoom
,getClusterLeaves
andgetClusterChildren
uses querySourceFeatures / featuresMatchingPredicate to get desired data, it sets a limitation on functionality provided by native (original) corresponding methods. For now, obtaining needed data from this method is only possible for the clusters that are currently rendered on the map. But according to docs of the SDK it should be possible to use it on any cluster ( even deeply nested )This PR updates these methods by passing the cluster itself not cluster_id.
Checklist
yarn generate
CHANGELOG.md
index.d.ts
)/example
)Screenshot OR Video
Possible use case:
To zoom or just find a cluster for any single point on the map.
Solution:
Recursively use
getClusterChildren(rootCluster)
to find desired cluster and then withgetClusterExpansionZoom(deeplyNestedCluster)
smoothly zoom to it. ( For example, user searches some place on the map using search input )Example