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: support SVG symbols (DHIS2-14440) #517

Merged
merged 4 commits into from
Jan 9, 2023
Merged

feat: support SVG symbols (DHIS2-14440) #517

merged 4 commits into from
Jan 9, 2023

Conversation

turban
Copy link
Collaborator

@turban turban commented Jan 6, 2023

This PR adds support for SVG images as map symbols.

Fixes:
https://dhis2.atlassian.net/browse/DHIS2-14440

Partly fixes:
https://dhis2.atlassian.net/browse/DHIS2-14438

MapLibre GL JS don't support SVG images: mapbox/mapbox-gl-js#5529
We translate the SVG image to a HTML Image element before it's added to the map.

We need to know the size when the SVG is translated. Currently we only support the size used for symbols in DHIS2 (16x16). This could be expanded later (by passing in with and height together with the SVG URL).

The PR also includes a fix so the addImages Promise.all will resolve if one image could not be loaded. If there is an issue with one image, we will write it to the console, but still show the others.

After this PR (the triangle symbol is originally SVG):
Screenshot 2023-01-06 at 10 04 40

@turban turban requested a review from jenniferarnesen January 6, 2023 11:20
@turban turban merged commit 87c25b9 into master Jan 9, 2023
@turban turban deleted the feat/DHIS2-14440 branch January 9, 2023 15:48
turban added a commit that referenced this pull request Jan 9, 2023
turban added a commit that referenced this pull request Jan 9, 2023
dhis2-bot added a commit that referenced this pull request Jan 12, 2023
# [3.7.0](v3.6.0...v3.7.0) (2023-01-12)

### Bug Fixes

* use the updated tokens in the publish step ([#521](#521)) ([ce19be7](ce19be7))

### Features

* support SVG symbols (DHIS2-14440) ([#517](#517)) ([87c25b9](87c25b9))
* support SVG symbols (DHIS2-14440) v2 ([#520](#520)) ([62f5eea](62f5eea))

### Reverts

* Revert "feat: support SVG symbols (DHIS2-14440) (#517)" (#519) ([17b32ca](17b32ca)), closes [#517](#517) [#519](#519)
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants