From 2935e2c83a1e0481ec79741f34e39950f0aab989 Mon Sep 17 00:00:00 2001 From: fechan Date: Thu, 6 Jun 2024 20:57:51 -0700 Subject: [PATCH] fix collision and z-index problems --- client/src/GraphUpdateCallbacks.ts | 4 +--- client/src/index.css | 27 --------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/client/src/GraphUpdateCallbacks.ts b/client/src/GraphUpdateCallbacks.ts index 50c22f1..ea01729 100644 --- a/client/src/GraphUpdateCallbacks.ts +++ b/client/src/GraphUpdateCallbacks.ts @@ -105,13 +105,11 @@ function onNodeDrag( y: mouseEvent.clientY, }); - // Get nodes that are under the mouse cursor AND are not the dragged node AND are compatible drop targets - // For the mouse checking, there's probably a dedicated function for it but I don't know what it is const intersections = getIntersectingNodes(boxToRect({ x: mousePosition.x, x2: mousePosition.x+.1, y: mousePosition.y, - y2: mousePosition.y+.1 + y2: mousePosition.y+50 // the 50 lets it detect the machine node's header (containing it name and attached peripherals) that's not technically part of the node })) .filter(node => node.id !== draggedNode.id && nodeIsCompatibleDropTarget(draggedNode, node)); diff --git a/client/src/index.css b/client/src/index.css index 48f7bd0..58eeac0 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -64,30 +64,3 @@ body, height: 100%; margin: 0; } - -/* .react-flow__node { - z-index: -1 !important; -} */ - -/* - HACK: Slot groups need to appear above their parent machine, - and dragged machines should appear above other machines. - The problem is, there's no class added to child nodes (slot groups) if - the parent is being dragged. - - This z-index stuff should probably be implemented in JS -*/ - -.react-flow__node.react-flow__node-machine { - z-index: -30 !important; -} - -.react-flow__node.react-flow__node-slot-group { - z-index: -20 !important; -} - -.react-flow__node.react-flow__node-machine.dragging { - z-index: -29 !important; -} - -/* END HACK */ \ No newline at end of file