cancel reparenting mode on changing parent

This commit is contained in:
poanse 2026-03-30 21:40:28 +03:00
parent 2a661389f0
commit adf5cd1fe4
3 changed files with 2 additions and 3 deletions

View file

@ -190,6 +190,7 @@ export class Context {
}
public finishReparenting(newParentId: TaskId) {
this.pressedButtonCode = -1;
if (this.reparentingTaskId == NoTaskId) {
throw new Error("Incorrect state: reparentingTaskId expected");
}

View file

@ -69,12 +69,10 @@
}
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
@ -98,7 +96,6 @@
context.chosenBlockerId = context.chosenBlockerId === NoTaskId ? context.selectedTaskId : NoTaskId;
}
}
let classString = $derived(`
${(isPressed && !isButtonDisabled) ? 'is-pressed-up ': ''}
${(isPressedDown && !isButtonDisabled) ? 'is-pressed-down ': '' }

View file

@ -92,6 +92,7 @@
else if (context.isReparentingOn()) {
if (context.isValidReparentingTarget(taskId)) {
context.finishReparenting(taskId);
context.cancelReparenting();
}
} else {
context.pressedButtonCode = -1;