Skip to content

proper scope highlighting #235

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

Merged
merged 1 commit into from
Apr 21, 2023
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
3 changes: 1 addition & 2 deletions ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
box-shadow: 0px 0px 12px 0px rgba(100, 100, 100, 0.9);
}

.react-flow__node-scope.selected,
.react-flow__node-scope:hover {
.react-flow__node-scope.selected {
box-shadow: 0px 0px 8px 0px rgba(100, 100, 100, 0.5);
}

Expand Down
6 changes: 5 additions & 1 deletion ui/src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ function CanvasImpl() {
store,
(state) => state.removeDragHighlight
);
const updateView = useStore(store, (state) => state.updateView);

const addNode = useStore(store, (state) => state.addNode);
const reactFlowInstance = useReactFlow();
Expand Down Expand Up @@ -584,7 +585,7 @@ function CanvasImpl() {
onEdgesChange={onEdgesChange}
onConnect={onConnect}
onNodeDragStop={(event, node) => {
// removeDragHighlight();
removeDragHighlight();
let mousePos = project({ x: event.clientX, y: event.clientY });
// check if the mouse is still inside this node. If not, the user
// has beenn trying to move a pod out.
Expand All @@ -601,11 +602,14 @@ function CanvasImpl() {
if (scope && scope.id !== node.parentNode) {
moveIntoScope(node.id, scope.id);
}
// update view manually to remove the drag highlight.
updateView();
}}
onNodeDrag={(event, node) => {
let mousePos = project({ x: event.clientX, y: event.clientY });
let scope = getScopeAtPos(mousePos, node.id);
if (scope) {
// The view is updated at the node position change.
setDragHighlight(scope.id);
} else {
removeDragHighlight();
Expand Down