Skip to content

Commit

Permalink
Merge pull request #24 from fechan/disconnection
Browse files Browse the repository at this point in the history
fix collision and z-index problems
  • Loading branch information
fechan authored Jun 7, 2024
2 parents aa4e93f + 2935e2c commit 4c22dee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
4 changes: 1 addition & 3 deletions client/src/GraphUpdateCallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
27 changes: 0 additions & 27 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 4c22dee

Please sign in to comment.