How can I make Svelte's DraggableDraw component not open at startup?

58 views Asked by At

I am currently using this Svelte component and I would like to know if anyone knows how the startup can be changed so that it does not open after loading, so that it only opens when pressing a button.

This is the link for the component I am referring to and this is the example in Svelte REPL.

Thank you for your attention.

1

There are 1 answers

1
Rich Harris On

The answer should be to change let visible = true to let visible = false. That fails because the component expects visible to be true initially. That seems like a bug, and you should probably raise it on the component's issue tracker.

Short of that, you can wrap the whole lot in {#if visible}:

{#if visible}
  <DraggableDraw {maxVH} {minVH}>
    <!-- ... -->
  </DraggableDraw>
{/if}

But that may not have the intended behaviour, since the component will now be recreated every time visible becomes true.