@@ -43,16 +43,18 @@ const handlerItems = computed(() => {
43
43
44
44
// determine which side of the handler to render the messageType on. If it's the left side (for a right arrow) then we apply a negative offset
45
45
const messageTypeOffset = handler .direction === Direction .Right ? ((messageTypeElement ?.getBBox ().width ?? 0 ) + 24 ) * - 1 : 20 ;
46
- if (messageTypeOffset < 0 ) {
47
- store .setStartX (- 1 * messageTypeOffset );
46
+ const left = (endpoint ?.centre ?? 0 ) - Handler_Width / 2 ;
47
+ const right = (endpoint ?.centre ?? 0 ) + Handler_Width / 2 ;
48
+ if (left + messageTypeOffset < 0 ) {
49
+ store .setStartX (- 1 * (left + messageTypeOffset ) + 20 );
48
50
}
49
51
50
52
return {
51
53
id: handler .id ,
52
54
endpointName: handler .endpoint .name ,
53
55
incomingId: handler .route ?.name ,
54
- left: ( endpoint ?. centre ?? 0 ) - Handler_Width / 2 ,
55
- right: ( endpoint ?. centre ?? 0 ) + Handler_Width / 2 ,
56
+ left ,
57
+ right ,
56
58
y ,
57
59
height ,
58
60
fill ,
@@ -61,6 +63,7 @@ const handlerItems = computed(() => {
61
63
messageType: handler .name ,
62
64
messageTypeOffset ,
63
65
messageTypeHighlight: handler .route ?.name === highlightId .value ,
66
+ setUIRef : (el : SVGElement ) => (handler .uiRef = el ),
64
67
};
65
68
});
66
69
@@ -76,10 +79,12 @@ function setMessageTypeRef(el: SVGTextElement, index: number) {
76
79
</script >
77
80
78
81
<template >
79
- <g v-for =" (handler, i) in handlerItems" :key =" handler.id" :transform =" `translate(${handler.left}, ${handler.y})`" >
82
+ <g v-for =" (handler, i) in handlerItems" :key =" `${ handler.id}###${handler.endpointName}` " :transform =" `translate(${handler.left}, ${handler.y})`" >
80
83
<!-- Handler Activation Box-->
81
- <rect :width =" Handler_Width" :height =" handler.height" :class =" handler.incomingId && 'clickable'" :fill =" handler.fill" @mouseover =" () => store.setHighlightId(handler.incomingId)" @mouseleave =" () => store.setHighlightId()" />
82
- <path v-if =" handler.icon" :d =" handler.icon" fill =" white" :transform =" `translate(${Handler_Width / 2 - handler.iconSize / 2}, ${handler.height / 2 - handler.iconSize / 2})`" />
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()" />
86
+ <path v-if =" handler.icon" :d =" handler.icon" fill =" white" :transform =" `translate(${Handler_Width / 2 - handler.iconSize / 2}, ${handler.height / 2 - handler.iconSize / 2})`" />
87
+ </g >
83
88
<!-- Message Type and Icon-->
84
89
<g
85
90
v-if =" handler.messageType"
0 commit comments