Skip to content

Commit 5ccc5c5

Browse files
committed
Improvement - VueUiDag - Highlight edge when hovering its midpoint
1 parent 53acfe8 commit 5ccc5c5

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/components/vue-ui-dag.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,16 +597,6 @@ async function getImage({ scale = 2} = {}) {
597597
}
598598
}
599599
600-
/**
601-
* TODO:
602-
* - events
603-
* - optional knots at mid-edge with events
604-
* - check if stroke can be made not to bleed out on nodes (like strokes on text elements)
605-
* - expose:
606-
* > control functions
607-
* > recomputeLayout
608-
*/
609-
610600
function getData() {
611601
return layoutData.value;
612602
}
@@ -817,7 +807,7 @@ defineExpose({
817807
:d="edge.pathData"
818808
fill="none"
819809
:stroke="edge.original.color ?? FINAL_CONFIG.style.chart.edges.stroke"
820-
:stroke-width="FINAL_CONFIG.style.chart.edges.strokeWidth * (edge.from === highlightedNodeId ? 2 : 1)"
810+
:stroke-width="FINAL_CONFIG.style.chart.edges.strokeWidth * ((edge.from === highlightedNodeId || edge.id === tooltipEdge?.id) ? 2 : 1)"
821811
stroke-linecap="round"
822812
stroke-linejoin="round"
823813
style="pointer-events: none; transition: stroke-width 0.2s ease-in-out"
@@ -831,7 +821,7 @@ defineExpose({
831821
:r="FINAL_CONFIG.style.chart.midpoints.radius"
832822
:fill="FINAL_CONFIG.style.chart.midpoints.fill"
833823
:stroke="edge.original.color ?? FINAL_CONFIG.style.chart.midpoints.stroke"
834-
:stroke-width="FINAL_CONFIG.style.chart.midpoints.strokeWidth * (edge.from === highlightedNodeId ? 2 : 1)"
824+
:stroke-width="FINAL_CONFIG.style.chart.midpoints.strokeWidth * ((edge.from === highlightedNodeId || edge.id === tooltipEdge?.id) ? 2 : 1)"
835825
style="transition: stroke-width 0.2s ease-in-out"
836826
@mouseenter="showMidpointTooltip(edge)"
837827
@mouseleave="hideMidpointTooltip"
@@ -924,7 +914,7 @@ defineExpose({
924914
:d="edge.pathData"
925915
fill="none"
926916
stroke="transparent"
927-
:stroke-width="FINAL_CONFIG.style.chart.edges.strokeWidth * (edge.from === highlightedNodeId ? 1.3 : 1)"
917+
:stroke-width="FINAL_CONFIG.style.chart.edges.strokeWidth * ((edge.from === highlightedNodeId || edge.id === tooltipEdge?.id) ? 1.3 : 1)"
928918
stroke-linecap="round"
929919
stroke-linejoin="round"
930920
:marker-end="layoutData.arrowShape === 'undirected'

src/useConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6799,7 +6799,7 @@ export function useConfig() {
67996799
align: undefined
68006800
},
68016801
nodes: {
6802-
stroke: COLOR_GREY_LIGHT,
6802+
stroke: COLOR_GREY_MID,
68036803
strokeWidth: 1,
68046804
borderRadius: 3,
68056805
backgroundColor: COLOR_WHITE,

0 commit comments

Comments
 (0)