From da936aabc96571e25bd845fa975efc2e35b71e1c Mon Sep 17 00:00:00 2001 From: MrCoder Date: Thu, 21 Nov 2024 20:41:40 +1100 Subject: [PATCH] Moved translateX to ArrowMixin.ts --- .../MessageLayer/Block/Statement/ArrowMixin.ts | 9 ++++++++- .../Block/Statement/Interaction/Interaction.vue | 6 ------ .../Statement/InteractionAsync/Interaction-async.vue | 8 -------- .../MessageLayer/Block/Statement/Return/Return.vue | 6 ------ 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin.ts b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin.ts index 2d63a414..2e7c11fb 100644 --- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin.ts +++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin.ts @@ -59,7 +59,14 @@ export default defineComponent({ anchorTarget: function (): Anchor { return new Anchor(this.centerOf(this.target), this.targetOffset); }, - + // Both 'left' and 'translateX' can be used to move the element horizontally. + // Change it to use translate according to https://stackoverflow.com/a/53892597/529187. + translateX: function () { + const destination = !this.rightToLeft + ? this.anchorSource + : this.anchorTarget; + return this.anchorOrigin.calculateEdgeOffset(destination); + }, interactionWidth: function (): number { return ( Math.abs(this.anchorSource.calculateEdgeOffset(this.anchorTarget)) - diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Interaction/Interaction.vue b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Interaction/Interaction.vue index 16d92d70..f8ad3850 100644 --- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Interaction/Interaction.vue +++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Interaction/Interaction.vue @@ -111,12 +111,6 @@ export default { signature: function () { return this.message?.SignatureText(); }, - translateX: function () { - const destination = !this.rightToLeft - ? this.anchorSource - : this.anchorTarget; - return this.anchorOrigin.calculateEdgeOffset(destination); - }, isCurrent: function () { return this.message?.isCurrent(this.cursor); }, diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/InteractionAsync/Interaction-async.vue b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/InteractionAsync/Interaction-async.vue index 07c1fe67..187701aa 100644 --- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/InteractionAsync/Interaction-async.vue +++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/InteractionAsync/Interaction-async.vue @@ -146,14 +146,6 @@ export default { anchorTarget: function () { return new Anchor(this.centerOf(this.target), this.targetOffset); }, - // Both 'left' and 'translateX' can be used to move the element horizontally. - // Change it to use translate according to https://stackoverflow.com/a/53892597/529187. - translateX: function () { - const destination = !this.rightToLeft - ? this.anchorSource - : this.anchorTarget; - return this.anchorOrigin.calculateEdgeOffset(destination); - }, signature: function () { return this.asyncMessage?.content()?.getFormattedText(); }, diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Return/Return.vue b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Return/Return.vue index 0a3e7869..e8a17711 100644 --- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Return/Return.vue +++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Return/Return.vue @@ -80,12 +80,6 @@ export default { asyncMessage: function () { return this.ret?.asyncMessage(); }, - translateX: function () { - const destination = !this.rightToLeft - ? this.anchorSource - : this.anchorTarget; - return this.anchorOrigin.calculateEdgeOffset(destination); - }, left: function () { return this.rightToLeft ? this.distance(this.target, this.origin)