{#if enable_layers}
(show_layers = false)} >
(show_layers = !show_layers)} > {show_layers ? "Layers" : $layers.layers.find((l) => l.id === $layers.active_layer)?.name}
{#if show_layers}
{#each $layers.layers as { id, name, user_created, visible }, i (i)}
{#if !visible}
{ e.stopPropagation(); dispatch("toggle_layer_visibility", id); }} /> {:else}
{ e.stopPropagation(); dispatch("toggle_layer_visibility", id); }} /> {/if}
change_layer(id)}>{name}
{#if $layers.layers.length > 1}
{#if i > 0}
{ e.stopPropagation(); move_layer(id, "up"); }} Icon={ArrowUp} size="x-small" /> {/if} {#if i < $layers.layers.length - 1}
{ e.stopPropagation(); move_layer(id, "down"); }} Icon={ArrowDown} size="x-small" /> {/if} {#if $layers.layers.length > 1 && user_created}
{ e.stopPropagation(); delete_layer(id); }} Icon={Clear} size="x-small" /> {/if}
{/if}
{/each} {#if enable_additional_layers}
{ e.stopPropagation(); new_layer(); }} size="x-small" />
{/if}
{/if}
{/if}