Skip to content

Commit 36f562c

Browse files
committed
fix startX determination now that endpoints render last
1 parent 0d330a7 commit 36f562c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Frontend/src/components/messages2/SequenceDiagram/EndpointsComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const endpointItems = computed(() =>
6767
);
6868
6969
watch(endpointItems, () => {
70-
store.setEndpointCentrePoints(endpointItems.value.map((endpoint) => ({ name: endpoint.name, centre: endpoint.x ?? 0, top: (endpoint.surround?.y ?? 0) + (endpoint.surround?.height ?? 0) + 15 }) as EndpointCentrePoint));
70+
store.setEndpointCentrePoints(endpointItems.value.map((endpoint) => ({ name: endpoint.name, centre: endpoint.x, top: (endpoint.surround?.y ?? 0) + (endpoint.surround?.height ?? 0) + 15 }) as EndpointCentrePoint));
7171
const lastEndpoint = endpointItems.value[endpointItems.value.length - 1];
7272
store.setMaxWidth((lastEndpoint.x ?? 0) + lastEndpoint.width);
7373
});

src/Frontend/src/components/messages2/SequenceDiagram/HandlersComponent.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const handlerItems = computed(() => {
5252
5353
//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
5454
const messageTypeOffset = handler.direction === Direction.Right ? ((messageTypeElement?.getBBox().width ?? 0) + 24) * -1 : 20;
55-
const left = (endpoint?.centre ?? 0) - Handler_Width / 2;
56-
const right = (endpoint?.centre ?? 0) + Handler_Width / 2;
55+
const left = (endpoint?.centre ?? store.startX) - Handler_Width / 2;
56+
const right = (endpoint?.centre ?? store.startX) + Handler_Width / 2;
5757
if (left + messageTypeOffset < 0) {
5858
store.setStartX(-1 * (left + messageTypeOffset) + 20);
5959
}

src/Frontend/src/components/messages2/SequenceDiagram/TimelineComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const { endpointCentrePoints, maxHeight } = storeToRefs(store);
88

99
<template>
1010
<g v-for="timeline in endpointCentrePoints" :key="timeline.name">
11-
<path :d="`M${timeline.centre} ${timeline.top} v0 ${maxHeight - timeline.top}`" stroke="var(--gray90)" stroke-width="2" />
11+
<path v-if="timeline.centre" :d="`M${timeline.centre} ${timeline.top} v0 ${maxHeight - timeline.top}`" stroke="var(--gray90)" stroke-width="2" />
1212
</g>
1313
</template>

src/Frontend/src/stores/SequenceDiagramStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import routeLinks from "@/router/routeLinks";
1010

1111
export interface EndpointCentrePoint {
1212
name: string;
13-
centre: number;
13+
centre?: number;
1414
top: number;
1515
}
1616

0 commit comments

Comments
 (0)