Skip to content

Commit

Permalink
Moved interactionWidth to ArrowMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCoder committed Nov 21, 2024
1 parent 27ab9e7 commit 89698f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import ArrowMixin from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/
import { _STARTER_ } from "@/parser/OrderedParticipants";
import { DirectionMixin } from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/DirectionMixin";
import { LIFELINE_WIDTH } from "@/positioning/Constants";
export default {
name: "interaction",
Expand Down Expand Up @@ -116,12 +115,6 @@ export default {
return this.message?.isCurrent(this.cursor);
},
interactionWidth: function () {
return (
Math.abs(this.anchorSource.calculateEdgeOffset(this.anchorTarget)) -
LIFELINE_WIDTH
);
},
isSelf: function () {
// this.to === undefined if it is a self interaction and root message.
return !this.target || this.target === this.source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import Message from "../Message/Message.vue";
import { mapGetters } from "vuex";
import { CodeRange } from "@/parser/CodeRange";
import ArrowMixin from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin";
import { LIFELINE_WIDTH } from "@/positioning/Constants";
import { DirectionMixin } from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/DirectionMixin";
import Anchor from "@/positioning/Anchor";

Expand Down Expand Up @@ -173,12 +172,6 @@ export default {

return (length - 1) * 7;
},
interactionWidth: function () {
return (
Math.abs(this.anchorSource.calculateEdgeOffset(this.anchorTarget)) -
LIFELINE_WIDTH
);
},
// 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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
'bare-target': bareTarget,
highlight: isCurrent,
}"
:style="{ ...borderWidth, width: width + 'px', left: left + 'px' }"
:style="{
...borderWidth,
width: interactionWidth + 'px',
left: left + 'px',
}"
>
<comment v-if="comment" :commentObj="commentObj" />
<div v-if="isSelf" class="flex items-center">
Expand Down Expand Up @@ -50,8 +54,6 @@ import Comment from "../Comment/Comment.vue";
import Message from "../Message/Message.vue";
import { mapGetters } from "vuex";
import { CodeRange } from "@/parser/CodeRange";
import WidthProviderOnBrowser from "@/positioning/WidthProviderFunc";
import { TextType } from "@/positioning/Coordinate";
import ArrowMixin from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/ArrowMixin";
import { DirectionMixin } from "@/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/DirectionMixin";
import { _STARTER_ } from "@/parser/OrderedParticipants";
Expand All @@ -74,11 +76,6 @@ export default {
asyncMessage: function () {
return this.ret?.asyncMessage();
},
width: function () {
return this.isSelf
? WidthProviderOnBrowser(this.signature, TextType.MessageContent)
: Math.abs(this.distance(this.target, this.source));
},
left: function () {
return this.rightToLeft
? this.distance(this.target, this.origin)
Expand Down

0 comments on commit 89698f0

Please sign in to comment.