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

Component as icon #295

Closed
KaevN opened this issue Jan 30, 2024 · 3 comments · Fixed by #337
Closed

Component as icon #295

KaevN opened this issue Jan 30, 2024 · 3 comments · Fixed by #337

Comments

@KaevN
Copy link

KaevN commented Jan 30, 2024

I'm trying to convert a project from leaflet to openlayers. In my project, I need to display custom icons on the map, but the problem is that for this I used a component that changes visually depending on the props. ol-style-icon only accepts the scr of the icon itself, this does not suit me, is there an option to use a Vue component as an icon?
image

@d-koppenhagen
Copy link
Collaborator

We had a pretty similar problem in the past. As far as I know there is currently no such direct feature.
Our solution was to generate an SVG and return an SVG inline data URL. This URL we passed as the src. It worked since the component generated the URL based on the input params.

@KaevN
Copy link
Author

KaevN commented Jan 31, 2024

We had a pretty similar problem in the past. As far as I know there is currently no such direct feature. Our solution was to generate an SVG and return an SVG inline data URL. This URL we passed as the src. It worked since the component generated the URL based on the input params.

interesting solution, can you be more specific, are you generating svg from a Vue component? if yes, what tool?

@d-koppenhagen
Copy link
Collaborator

I am simply building the SVG string and put it into a data URL.
With this tool, you can try it out: https://yoksel.github.io/url-encoder/

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 a pull request may close this issue.

2 participants