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

Adding styles to an annotation #62

Open
DaniilGiz opened this issue May 23, 2024 · 3 comments
Open

Adding styles to an annotation #62

DaniilGiz opened this issue May 23, 2024 · 3 comments

Comments

@DaniilGiz
Copy link

DaniilGiz commented May 23, 2024

I'm using your map to display multiple annotations on a map, and there may be a case where these annotations are close to each other. And I also use custom styles for annotation. When I hover over an annotation that is below another, I want to be able to add styles to the annotation, such as z-index, so that the annotation I hovered over is visible. This is currently not possible. I have an example from vio where they have custom annotations on the map, and I have a similar situation.

@Nicolapps
Copy link
Owner

Hello,

The annotations are rendered on the map by MapKit JS, which controls their ordering. You might be able to achieve what you’re looking for with the displayPriority attribute, have you tried it?

@DaniilGiz
Copy link
Author

DaniilGiz commented May 24, 2024

Hello.

Yes, I tried to do that. I tried to set the initial display priority as undefiend, and then change it to required on hover, but it doesn't work.
After that I set all priority = high, and then when hovering to required, but that didn't work either, my annotations started to disappear.

The only thing that helped me was when the props annotation selected is true, then it appears on top of the other annotations. But this approach also requires a lot of writing, because I use calloutElement and I need the selected state for it.

@nikischin
Copy link
Contributor

@DaniilGiz Happy to see you using the calloutElements already quickly after they were introduced. However, please note that there are still some bugs related to those unfortunately, so that in some cases when annotations are too close to each other (like the example you described) it might be possible this actually crashes your app unfortunately. I am currently investigating into this however, unfortunately I haven't yet figured out the reason or how to fix it and it currently looks like some strange behavior within Mapkit itself.

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

No branches or pull requests

3 participants