Dropping the same resource onto factory deselects it

This commit is contained in:
thepaperpilot 2023-04-23 12:06:30 -05:00
parent 9e0ed21a2f
commit e2480e2966

View file

@ -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