fix: Add Device dropdown was immediately closed by window onclick handler

This commit is contained in:
joren
2026-03-30 00:13:46 +02:00
parent 5a52987fbd
commit b3c7955340

View File

@@ -239,6 +239,8 @@
if (svgEl && !svgEl.contains(e.target as Node)) return;
contextMenu = null;
nodeContextMenu = null;
showVirtualMenu = false;
if (e.button === 2) return;
const pt = svgPoint(e);
const target = e.target as HTMLElement;
@@ -418,7 +420,7 @@
onDestroy(() => { destroyGraph(); });
</script>
<svelte:window onkeydown={onKey} onclick={() => { contextMenu = null; nodeContextMenu = null; showVirtualMenu = false; }} />
<svelte:window onkeydown={onKey} onclick={() => { contextMenu = null; nodeContextMenu = null; }} />
<div class="wrap">
<div class="toolbar">
@@ -453,8 +455,7 @@
<button onclick={() => { showMergeDialog = !showMergeDialog; showHideDialog = false; showProfileDialog = false; showRuleDialog = false; }} title="Node merging rules">Merge Nodes</button>
<button onclick={() => { showRuleDialog = !showRuleDialog; showHideDialog = false; showMergeDialog = false; showProfileDialog = false; }} title="Manage patchbay rules">Rules</button>
<button onclick={() => { showProfileDialog = !showProfileDialog; showHideDialog = false; showMergeDialog = false; showRuleDialog = false; }} title="Save/load profiles">Profiles</button>
<span class="sep"></span>
<button class="add-btn" onclick={() => { showVirtualMenu = !showVirtualMenu; }} title="Add virtual device">+ Add Device</button>
<button onclick={() => { showVirtualMenu = !showVirtualMenu; showHideDialog = false; showMergeDialog = false; showProfileDialog = false; showRuleDialog = false; }} title="Add virtual device">+ Add</button>
<span class="stats">{$nodes.length}N {$ports.length}P {$links.length}L {#if $patchbay.pinned_connections.length > 0}{$patchbay.pinned_connections.length}p{/if}</span>
</div>