@@ -10,7 +10,7 @@ const Handler_Gap = 20;
1010const Handler_Width = 14 ;
1111
1212const store = useSequenceDiagramStore ();
13- const { handlers, endpointCentrePoints, highlightId } = storeToRefs (store );
13+ const { handlers, endpointCentrePoints, highlightId, selectedId } = storeToRefs (store );
1414
1515const messageTypeRefs = ref <SVGTextElement []>([]);
1616
@@ -27,6 +27,7 @@ const handlerItems = computed(() => {
2727 const fill = (() => {
2828 if (handler .id === " First" ) return " black" ;
2929 if (handler .state === HandlerState .Fail ) return " var(--error)" ;
30+ if (handler .route ?.name === selectedId .value ) return " var(--highlight)" ;
3031 if (handler .route ?.name === highlightId .value ) return " var(--highlight-background)" ;
3132 return " var(--gray60)" ;
3233 })();
@@ -51,6 +52,8 @@ const handlerItems = computed(() => {
5152
5253 return {
5354 id: handler .id ,
55+ messageId: { id: handler .selectedMessage ?.message_id , uniqueId: handler .selectedMessage ?.id },
56+ isError: handler .state === HandlerState .Fail ,
5457 endpointName: handler .endpoint .name ,
5558 incomingId: handler .route ?.name ,
5659 left ,
@@ -63,6 +66,7 @@ const handlerItems = computed(() => {
6366 messageType: handler .name ,
6467 messageTypeOffset ,
6568 messageTypeHighlight: handler .route ?.name === highlightId .value ,
69+ messageTypeSelected: handler .route ?.name === selectedId .value ,
6670 setUIRef : (el : SVGElement ) => (handler .uiRef = el ),
6771 };
6872 });
@@ -81,18 +85,32 @@ function setMessageTypeRef(el: SVGTextElement, index: number) {
8185<template >
8286 <g v-for =" (handler, i) in handlerItems" :key =" `${handler.id}###${handler.endpointName}`" :transform =" `translate(${handler.left}, ${handler.y})`" >
8387 <!-- Handler Activation Box-->
84- <g :ref =" (el) => handler.setUIRef(el as SVGElement)" >
85- <rect :width =" Handler_Width" :height =" handler.height" :class =" handler.incomingId && 'clickable'" :fill =" handler.fill" @mouseover =" () => store.setHighlightId(handler.incomingId)" @mouseleave =" () => store.setHighlightId()" />
88+ <g :ref =" (el) => handler.setUIRef(el as SVGElement)" class =" activation-box" >
89+ <rect
90+ :width =" Handler_Width"
91+ :height =" handler.height"
92+ :class =" {
93+ clickable: handler.incomingId && !handler.messageTypeSelected,
94+ }"
95+ :fill =" handler.fill"
96+ @mouseover =" () => store.setHighlightId(handler.incomingId)"
97+ @mouseleave =" () => store.setHighlightId()"
98+ @click =" handler.incomingId && !handler.messageTypeSelected && store.navigateTo(handler.messageId.uniqueId, handler.messageId.id, handler.isError)"
99+ />
86100 <path v-if =" handler.icon" :d =" handler.icon" fill =" white" :transform =" `translate(${Handler_Width / 2 - handler.iconSize / 2}, ${handler.height / 2 - handler.iconSize / 2})`" />
87101 </g >
88102 <!-- Message Type and Icon-->
89103 <g
90104 v-if =" handler.messageType"
91105 :transform =" `translate(${handler.messageTypeOffset}, 4)`"
92- class =" clickable"
93- :fill =" handler.messageTypeHighlight ? 'var(--highlight)' : 'var(--gray40)'"
106+ :class =" {
107+ clickable: !handler.messageTypeSelected,
108+ 'message-type': true,
109+ highlight: handler.messageTypeHighlight || handler.messageTypeSelected,
110+ }"
94111 @mouseover =" () => store.setHighlightId(handler.incomingId)"
95112 @mouseleave =" () => store.setHighlightId()"
113+ @click =" handler.incomingId && !handler.messageTypeSelected && store.navigateTo(handler.messageId.uniqueId, handler.messageId.id, handler.isError)"
96114 >
97115 <path d =" M9,3L9,3 9,0 0,0 0,3 4,3 4,6 0,6 0,9 4,9 4,12 0,12 0,15 9,15 9,12 5,12 5,9 9,9 9,6 5,6 5,3z" />
98116 <text x =" 14" y =" 10" alignment-baseline =" middle" :ref =" (el) => setMessageTypeRef(el as SVGTextElement, i)" >{{ handler.messageType }}</text >
@@ -104,4 +122,16 @@ function setMessageTypeRef(el: SVGTextElement, index: number) {
104122.clickable {
105123 cursor : pointer ;
106124}
125+
126+ .activation-box :focus {
127+ outline : none ;
128+ }
129+
130+ .message-type {
131+ fill : var (--gray40 );
132+ }
133+
134+ .message-type.highlight {
135+ fill : var (--highlight );
136+ }
107137 </style >
0 commit comments