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

Add CustomControl components #19

Merged
merged 17 commits into from
Nov 21, 2024
Prev Previous commit
Next Next commit
tinyfix
Kanahiro authored and ciscorn committed Nov 21, 2024

Verified

This commit was signed with the committer’s verified signature.
ciscorn Taku Fukada
commit 888dec89fcf5844dea1a43f45fc0df402049d227
3 changes: 1 addition & 2 deletions src/lib/maplibre/controls/CustomControl/Control.svelte
Original file line number Diff line number Diff line change
@@ -11,12 +11,11 @@
children?: Snippet;
}
let { position, control, children }: Props = $props();
if (!control && !children) throw new Error('You must provide either control or children.');

const mapCtx = getMapContext();
if (!mapCtx.map) throw new Error('Map instance is not initialized.');

if (!control && !children) throw new Error('You must provide either control or children.');

let el: HTMLDivElement | undefined = $state(undefined);
if (children) {
control = {