Skip to content

Commit

Permalink
visible indicator that a node handle is clickable for tools menu
Browse files Browse the repository at this point in the history
  • Loading branch information
haschek committed Aug 8, 2023
1 parent fac2830 commit 2177bdc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/extensions/react-flow/handles/HandleDefault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ export const HandleDefault = memo(({ flowVersion, data, tooltip, children, ...ha
if (isToolsContent && !toolsDisplayed) {
handleContent = <HandleContent {...data}></HandleContent>;
}
const handleClick = React.useCallback(() => setToolsDisplayed(!toolsDisplayed), [])
const handleClick = React.useCallback(() => setToolsDisplayed(!toolsDisplayed), []);

const handleConfig = {
...handleProps,
...tooltipTitle,
className: isToolsContent ? "clickable" : undefined,
onClick: isToolsContent ? handleClick : undefined,
};

Expand Down
23 changes: 21 additions & 2 deletions src/extensions/react-flow/handles/_handles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ div.react-flow__handle {

&::before {
position: absolute;
inset: $eccgui-size-block-whitespace * -0.5 $eccgui-size-block-whitespace * -0.5 $eccgui-size-block-whitespace *
-0.5 $eccgui-size-block-whitespace * -0.5;
inset: $eccgui-size-block-whitespace * -0.5;
z-index: 1;
display: none;
content: " ";
background-color: currentcolor;
Expand All @@ -23,6 +23,19 @@ div.react-flow__handle {
opacity: 0.61;
}

&.clickable {
&::after {
position: absolute;
inset: $eccgui-size-block-whitespace * -0.75;
z-index: -1;
display: none;
cursor: pointer;
content: " ";
border-radius: 100%;
outline: dotted $eccgui-size-block-whitespace * 0.25 currentcolor;
}
}

&:hover {
&::before {
box-shadow: 0 0 $eccgui-size-block-whitespace * 0.5 $eccgui-size-block-whitespace * 0.25 currentcolor;
Expand All @@ -43,6 +56,12 @@ div.react-flow__handle {
}
}

.react-flow__node:hover &.clickable {
&::after {
display: block;
}
}

&.react-flow__handle-connecting:hover,
&.invalid-handle {
color: $eccgui-color-danger-text;
Expand Down

0 comments on commit 2177bdc

Please sign in to comment.