ui-charts: make picking elements modular #963
Merged
+62
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
PickingElement
is a closed type: only 3 types explicitly listed inside osrd-ui are accepted. External layers can't define their own picking elements. For instance, an external user with a custom work schedule layer cannot define a work schedule element to display a tooltip on hover.Fix this by making
PickingElement
an open-ended type: it only has atype
field, rest of the fields are layer-specific. Each layer defines the more specific type and provides a helper to convert to that more specific type.(I've contemplated using generics instead, but they spread all over the place and make everything more complicated.)
See individual commits.
Closes #958