From 034f52d99a275f2820c133bf39806278f8bf68d9 Mon Sep 17 00:00:00 2001 From: poanse <50020771+poanse@users.noreply.github.com> Date: Mon, 2 Feb 2026 16:39:10 +0300 Subject: [PATCH] reparenting cancel fix --- src/components/Button.svelte | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Button.svelte b/src/components/Button.svelte index 889341d..0324a1b 100644 --- a/src/components/Button.svelte +++ b/src/components/Button.svelte @@ -57,24 +57,31 @@ if (isButtonDisabled) { return; } - if (context.pressedButtonCode !== iconCode) { + isPressedDown = false; + event.stopPropagation(); + + if (context.pressedButtonCode !== -1) { + // cancel all active modes context.cancelReparenting(); context.chosenBlockerId = NoTaskId; context.chosenBlockedId = NoTaskId; } - isPressedDown = false; if (isPressed) { + // pressed the same button a second time isPressed = false; context.pressedButtonCode = -1; + return; } else if (stateful) { + // pressed a stateful button isPressed = true; context.pressedButtonCode = iconCode; } else { + // pressed a stateless button context.pressedButtonCode = -1; } if (isStatusCode(iconCode)) { context.changeStatus(toStatusCode(iconCode)); - }else if (iconCode == IconCode.REPARENT) { + } else if (iconCode == IconCode.REPARENT) { context.startReparenting(context.selectedTaskId); } else if (iconCode === IconCode.FOCUS) { context.changeFocusedTask(context.selectedTaskId); @@ -89,7 +96,6 @@ } else if (iconCode == IconCode.LOCK) { context.chosenBlockerId = context.chosenBlockerId === NoTaskId ? context.selectedTaskId : NoTaskId; } - event.stopPropagation(); } let classString = $derived(`