@@ -43,16 +43,18 @@ const handlerItems = computed(() => {
4343
4444 // 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
4545 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 );
4850 }
4951
5052 return {
5153 id: handler .id ,
5254 endpointName: handler .endpoint .name ,
5355 incomingId: handler .route ?.name ,
54- left: ( endpoint ?. centre ?? 0 ) - Handler_Width / 2 ,
55- right: ( endpoint ?. centre ?? 0 ) + Handler_Width / 2 ,
56+ left ,
57+ right ,
5658 y ,
5759 height ,
5860 fill ,
@@ -61,6 +63,7 @@ const handlerItems = computed(() => {
6163 messageType: handler .name ,
6264 messageTypeOffset ,
6365 messageTypeHighlight: handler .route ?.name === highlightId .value ,
66+ setUIRef : (el : SVGElement ) => (handler .uiRef = el ),
6467 };
6568 });
6669
@@ -76,10 +79,12 @@ function setMessageTypeRef(el: SVGTextElement, index: number) {
7679 </script >
7780
7881<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})`" >
8083 <!-- 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 >
8388 <!-- Message Type and Icon-->
8489 <g
8590 v-if =" handler.messageType"
0 commit comments