From e2480e2966dc75320d83bdaa7d133ba906fc0fb1 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 23 Apr 2023 12:06:30 -0500 Subject: [PATCH] Dropping the same resource onto factory deselects it --- src/data/projEntry.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index f44f976..1bcab95 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -414,7 +414,12 @@ export const main = createLayer("main", function (this: BaseLayer) { return otherNode.type === "resource"; }, onDrop(node, otherNode) { - node.state = (otherNode.state as unknown as ResourceState).type; + const droppedType = (otherNode.state as unknown as ResourceState).type; + if (node.state === droppedType) { + node.state = undefined; + } else { + node.state = droppedType; + } board.selectedNode.value = node; }, draggable: true