Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix collision and z-index problems #24

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */
Loading