From 4615e84a11c3eac47fc00fabd1813b82bb2cfeff Mon Sep 17 00:00:00 2001 From: poanse <50020771+poanse@users.noreply.github.com> Date: Mon, 22 Dec 2025 09:33:51 +0300 Subject: [PATCH] subtoolbar out transition and location fix --- src/Context.svelte.ts | 4 ++-- src/components/Button.svelte | 8 ++++---- src/components/TaskmapContainer.svelte | 8 ++------ src/components/Toolbar.svelte | 13 ++++++++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Context.svelte.ts b/src/Context.svelte.ts index 2dd548b..46287bd 100644 --- a/src/Context.svelte.ts +++ b/src/Context.svelte.ts @@ -10,7 +10,7 @@ export class Context { app: App; view: TaskmapView; nodePositionsCalculator: NodePositionsCalculator; - pressedButtonIndex = $state(-1); + pressedButtonCode = $state(-1); selectedTaskId = $state(-1); toolbarStatus = $state(StatusCode.DRAFT); projectData: ProjectData; @@ -139,7 +139,7 @@ export class Context { public serializeForDebugging() { return JSON.stringify({ - pressedButtonIndex: this.pressedButtonIndex, + pressedButtonIndex: this.pressedButtonCode, selectedTaskId: this.selectedTaskId, toolbarStatus: this.toolbarStatus, projectData: this.projectData, diff --git a/src/components/Button.svelte b/src/components/Button.svelte index 53f6ab4..ed83310 100644 --- a/src/components/Button.svelte +++ b/src/components/Button.svelte @@ -12,7 +12,7 @@ } = $props(); let isPressedDown = $state(false); - let isPressed=$derived(context.pressedButtonIndex == iconCode); + let isPressed=$derived(context.pressedButtonCode == iconCode); const stateful = iconCode != IconCode.FOCUS; @@ -32,12 +32,12 @@ isPressedDown = false; if (isPressed) { isPressed = false; - context.pressedButtonIndex = -1; + context.pressedButtonCode = -1; } else if (stateful) { isPressed = true; - context.pressedButtonIndex = iconCode; + context.pressedButtonCode = iconCode; } else { - context.pressedButtonIndex = -1; + context.pressedButtonCode = -1; } let newStatus: StatusCode | null = null; if (iconCode == IconCode.STATUS_READY) { diff --git a/src/components/TaskmapContainer.svelte b/src/components/TaskmapContainer.svelte index 5e219b0..0012177 100644 --- a/src/components/TaskmapContainer.svelte +++ b/src/components/TaskmapContainer.svelte @@ -109,7 +109,7 @@ if (e.button as MouseDown == MouseDown.LEFT) { console.log(`Window clicked + ${context.serializeForDebugging()}`); console.log('selectedTaskId ' + context.selectedTaskId); - context.pressedButtonIndex = -1; + context.pressedButtonCode = -1; context.setSelectedTaskId(-1); viewportEl!.focus(); e.stopPropagation(); @@ -158,11 +158,7 @@ {/each} - {#if context.selectedTaskId !== -1} - - {/if} + diff --git a/src/components/Toolbar.svelte b/src/components/Toolbar.svelte index ccda05b..c152d8c 100644 --- a/src/components/Toolbar.svelte +++ b/src/components/Toolbar.svelte @@ -28,6 +28,7 @@ +{#if context.selectedTaskId !== -1}
{/key}
-{#if context.pressedButtonIndex === IconCode.REMOVE} +{/if} + +{#if context.pressedButtonCode === IconCode.REMOVE && context.selectedTaskId !== -1}
{#key context.updateOnZoomCounter} @@ -64,13 +67,14 @@ {/key}
{/if} -{#if context.pressedButtonIndex === IconCode.STATUS} + +{#if context.pressedButtonCode === IconCode.STATUS && context.selectedTaskId !== -1}
{#key context.updateOnZoomCounter} @@ -83,7 +87,6 @@ {/if}