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

Ability to override UI for existing controls #39

Open
dimfeld opened this issue Jul 14, 2023 · 0 comments
Open

Ability to override UI for existing controls #39

dimfeld opened this issue Jul 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dimfeld
Copy link
Owner

dimfeld commented Jul 14, 2023

Specifically in the context of the GeolocateControl, as mentioned by @dominikg on the Svelte Discord.

Proposed method, which I haven't tried yet but I think should work ok:

Subclass the GeolocateControl class from maplibre, and override its onAdd function to call super.onAdd(map), but return a different DOM element managed by Svelte.

Then when your button is clicked, call the trigger method on the control to do the position update. You can also listen to events emitted by the control to perform other UI updates.

I think adding a slot into the GeolocateControl component, and checking for $$slots.default to enable the UI override functionality might be a good way to accomplish this.

@dimfeld dimfeld added the enhancement New feature or request label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant