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.
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 callsuper.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.