diff --git a/packages/svelte/src/toolbar/Icon.svelte b/packages/svelte/src/toolbar/Icon.svelte index 66c4e241ce..ae0d2470d6 100644 --- a/packages/svelte/src/toolbar/Icon.svelte +++ b/packages/svelte/src/toolbar/Icon.svelte @@ -1,6 +1,6 @@ svelte-logosvelte-inspector>} */ let active_tools = $state(new SvelteMap()); @@ -20,6 +20,8 @@ let dragOffsetY = 0; onMount(() => { + toolbar.style.right = '20px'; + toolbar.style.bottom = '20px'; recalculate_toolbar_panel_position(); }); @@ -33,14 +35,17 @@ if (tool.component) mounted_component = mountTool(tool.component, tool.name, { tool }); active_tools.set(tool.name, mounted_component); - tool.activate(); + if (tool.activate) tool.activate(); } else { const mounted_component = active_tools.get(tool.name); if (tool.component && mounted_component) unmountTool(mounted_component, tool.name); - tool.deactivate(); + if (tool.deactivate) tool.deactivate(); active_tools.delete(tool.name); } + + if (active_tools.size === 0) toolbarPanels.style.display = 'none'; + else toolbarPanels.style.display = 'block'; } /** @@ -99,24 +104,21 @@ async function toggle_toolbar() { open = !open; - - // need to wait here, so that the toolbar can close first await tick(); - recalculate_toolbar_panel_position(); } function recalculate_toolbar_panel_position() { const rect = toolbar.getBoundingClientRect(); toolbarPanels.style.right = toolbar.style.right; - toolbarPanels.style.bottom = parseFloat(toolbar.style.bottom ?? 0) + rect.height + 'px'; + toolbarPanels.style.bottom = parseFloat(toolbar.style.bottom ?? 0) + rect.height + 10 + 'px'; // Add a small gap }
{#if open} -
-
+
diff --git a/packages/svelte/src/toolbar/tools/config/Config.svelte b/packages/svelte/src/toolbar/tools/config/Config.svelte index 31de3c36b4..9a7f2640b4 100644 --- a/packages/svelte/src/toolbar/tools/config/Config.svelte +++ b/packages/svelte/src/toolbar/tools/config/Config.svelte @@ -10,39 +10,13 @@ -
- -
-
- -
-
-