-
Notifications
You must be signed in to change notification settings - Fork 12
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
[WIP] Custom JS injection #191
base: main
Are you sure you want to change the base?
Conversation
@ebrelsford I have a few todo's in here, but am already using this downstream off this branch and it meets our needs. If this seems like an acceptable advanced feature, I can go ahead and finish those up before putting up for official review. Do you see any issues with this as a feature or with the implementation? |
@aparlato This approach generally looks good to me! Maybe this is for future consideration, but I do wonder if there's a case to be made for completely transforming a style? For example if you want to change all instances of a given field name or color in paint properties or something simpler like changing |
If I'm understanding the ask/suggestion here correctly, I'd rather put the onus of that on the user to write their custom script. Partially because it's more flexible and partially because it's an advanced feature I wouldn't want to encourage by making too user friendly. I'll send you an implementation of this in Slack that does this as I don't want to post publicly on this PR. |
Yeah maybe at some point we just document that as a possibility for when it comes up. |
Looks like the Can be worked around by using an empty array. |
Description
Downstream client is looking for a way to inject custom JS actions to act on the map through Maperture. This PR experiments with one way to handle this. This would be an advanced feature that we would likely discourage for typical use.
Functions are passed separately in the config as we handle the map objects (presets, etc) in a way that needs to go between strings and objects which removes functions.
The function passed should be a factory function that takes a
map
argument and spits out a function that acts on that map to be run on clicking the option. These changes do not persist if the map style is changed or closed. They do not persist across styles.TODO
dropdown
(maybebutton
)Closes #
QA steps
Author checklist
Create the PR
After approval
main
into your branch, resolve any conflictsmain