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

feat: highlight and animate feature(s) by ID #1176

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

RobertOrthofer
Copy link
Contributor

@RobertOrthofer RobertOrthofer commented Aug 2, 2024

This PR implements animations for programmatic feature selection for both VectorLayer and VectorTileLayer without causing a version jump of the map element.

The internally used panIntoFeature function has been lifted to the level of the interaction, exposing it the same way as the highlightById function as a method of the interaction itself.

The existing highlightById-method now has an optional second parameter, fitOptions, allowing animations to highlighted Features of VectorLayer and RenderFeatures of a VectorTileLayer. Be aware that when programmatically selecting a feature, the source has to be loaded, and, in the case of the VectorTileLayer, the feature has to be available in currently rendered tiles. The fitOptions also include convenient properties like padding or maxZoom.

This is designed as convenience-functionality for the select-Interaction, as an improvement of the existing highlightById method. Arguments could be made for the panIn-flag to be replaced completely by fitOptions, in order to have more control over animations (this is currently static with duration: 750 and no padding), but this would mean a version jump.

#570
#1097

Screenshots/Videos

Checklist before requesting a review

Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for eoxelements ready!

Name Link
🔨 Latest commit 66ed0c8
🔍 Latest deploy log https://app.netlify.com/sites/eoxelements/deploys/66b0cd11e88246000876be42
😎 Deploy Preview https://deploy-preview-1176--eoxelements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@RobertOrthofer RobertOrthofer marked this pull request as ready for review August 5, 2024 07:18
@silvester-pari silvester-pari self-requested a review August 5, 2024 12:39
Copy link
Collaborator

@silvester-pari silvester-pari left a comment

Choose a reason for hiding this comment

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

Great addition, thanks! Fine for me to add this now, and add an issue that deprecates the panIn property for v2.x

Could we just add a story for this functionality? I'll see if I find time for this today, otherwise any other volunteers welcome 😃

@silvester-pari
Copy link
Collaborator

I added a story showcasing this:

Screencast.from.2024-08-05.15.01.52.webm

Copy link
Member

@santilland santilland left a comment

Choose a reason for hiding this comment

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

For me also looks good, not using it right now in any application, so probably good to see if @StefanBrand has feedback?

@RobertOrthofer
Copy link
Contributor Author

RobertOrthofer commented Aug 5, 2024

thanks @silvester-pari, this story is indeed a very good showcase of this feature

@RobertOrthofer
Copy link
Contributor Author

About the panIn-option, maybe we don't need to get rid of it entirely, as it is a good way to pan in to something without using JS (only via the config), but we could use fitOptions instead of a boolean flag

@silvester-pari silvester-pari changed the title feat: highlight and animate by ID feat: highlight and animate feature(s) by ID Aug 5, 2024
@silvester-pari silvester-pari linked an issue Aug 5, 2024 that may be closed by this pull request
@silvester-pari silvester-pari merged commit 1f95016 into main Aug 5, 2024
7 checks passed
@silvester-pari silvester-pari deleted the map/feat/select-by-id branch August 5, 2024 15:37
This was referenced Aug 5, 2024
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.

Select By ID
3 participants