streamline initialized

This commit is contained in:
peterkogo
2025-04-09 15:09:30 +02:00
parent 739d557010
commit 108f1ce81c
10 changed files with 18 additions and 408 deletions
@@ -17,6 +17,7 @@
panOnDrag = true,
panOnScroll = false,
paneClickDistance = 1,
oninit,
children
}: ZoomProps = $props();
@@ -25,6 +26,14 @@
// We extract the initial value by destructuring
const { viewport: initialViewport } = store;
let onInitCalled = false;
$effect(() => {
if (!onInitCalled && store.viewportInitialized) {
oninit?.();
onInitCalled = true;
}
});
</script>
<div
@@ -16,4 +16,5 @@ export type ZoomProps = {
panOnDrag: boolean | number[];
paneClickDistance: number;
children: Snippet;
oninit?: () => void;
};