diff --git a/d2layouts/d2sequence/sequence_diagram.go b/d2layouts/d2sequence/sequence_diagram.go
index b0efef69f..9d70eb837 100644
--- a/d2layouts/d2sequence/sequence_diagram.go
+++ b/d2layouts/d2sequence/sequence_diagram.go
@@ -260,7 +260,12 @@ func (sd *sequenceDiagram) routeMessages() {
}
if message.Attributes.Label.Value != "" {
- message.LabelPosition = go2.Pointer(string(label.InsideMiddleCenter))
+ if isLeftToRight {
+ message.LabelPosition = go2.Pointer(string(label.OutsideTopCenter))
+ } else {
+ // the label will be placed above the message because the orientation is based on the edge normal vector
+ message.LabelPosition = go2.Pointer(string(label.OutsideBottomCenter))
+ }
}
}
}
diff --git a/e2etests/testdata/stable/sequence_diagram_simple/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_simple/dagre/board.exp.json
index 7260594d3..1fc4cf4c9 100644
--- a/e2etests/testdata/stable/sequence_diagram_simple/dagre/board.exp.json
+++ b/e2etests/testdata/stable/sequence_diagram_simple/dagre/board.exp.json
@@ -220,7 +220,7 @@
"underline": false,
"labelWidth": 155,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_TOP_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -259,7 +259,7 @@
"underline": false,
"labelWidth": 801,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_TOP_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -298,7 +298,7 @@
"underline": false,
"labelWidth": 131,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_BOTTOM_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -415,7 +415,7 @@
"underline": false,
"labelWidth": 164,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_BOTTOM_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -454,7 +454,7 @@
"underline": false,
"labelWidth": 210,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_TOP_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -493,7 +493,7 @@
"underline": false,
"labelWidth": 65,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_TOP_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -532,7 +532,7 @@
"underline": false,
"labelWidth": 44,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_BOTTOM_CENTER",
"labelPercentage": 0,
"route": [
{
@@ -571,7 +571,7 @@
"underline": false,
"labelWidth": 219,
"labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPosition": "OUTSIDE_BOTTOM_CENTER",
"labelPercentage": 0,
"route": [
{
diff --git a/e2etests/testdata/stable/sequence_diagram_simple/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_simple/dagre/sketch.exp.svg
index 2b277bd9e..c51dfc31d 100644
--- a/e2etests/testdata/stable/sequence_diagram_simple/dagre/sketch.exp.svg
+++ b/e2etests/testdata/stable/sequence_diagram_simple/dagre/sketch.exp.svg
@@ -14,31 +14,7 @@ width="2238" height="2088" viewBox="-100 -50 2238 2088">AlicelinebreakerBobdbqueueanoddservicewithanameinmultiple lines
-
-
-Authentication Request
-
-
-make request for something that is quite far away and requires a really long label to take all the space between the objects
-
-
-validate credentials
-
-
-Authentication Response
-
-
-Another authentication Request
-
-
-do it later
-
-
-stored
-
-
-Another authentication ResponseAlicelinebreakerBobdbqueueanoddservicewithanameinmultiple lines Authentication Requestmake request for something that is quite far away and requires a really long label to take all the space between the objectsvalidate credentialsAuthentication ResponseAnother authentication Requestdo it later storedAnother authentication ResponseAlicelinebreakerBobdbqueueanoddservicewithanameinmultiple lines
-
-
-Authentication Request
-
-
-make request for something that is quite far away and requires a really long label to take all the space between the objects
-
-
-validate credentials
-
-
-Authentication Response
-
-
-Another authentication Request
-
-
-do it later
-
-
-stored
-
-
-Another authentication ResponseAlicelinebreakerBobdbqueueanoddservicewithanameinmultiple lines Authentication Requestmake request for something that is quite far away and requires a really long label to take all the space between the objectsvalidate credentialsAuthentication ResponseAnother authentication Requestdo it later storedAnother authentication ResponsescoreritemResponseitemessayRubricconceptitemOutcome
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)scoreritemResponseitemessayRubricconceptitemOutcome getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)scoreritemResponseitemessayRubricconceptitemOutcome
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)scoreritemResponseitemessayRubricconceptitemOutcome getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)a_shapea_sequenceanotherfinallysequencesequencesequencescoreritemResponseitemessayRubricconceptitemOutcomescorerconceptessayRubricitemitemOutcomeitemResponsescoreritemResponseitemessayRubricconceptitemOutcome
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)a_shapea_sequenceanotherfinallysequencesequencesequencescoreritemResponseitemessayRubricconceptitemOutcomescorerconceptessayRubricitemitemOutcomeitemResponsescoreritemResponseitemessayRubricconceptitemOutcome getItem()itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)getItem()itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)a_shapea_sequenceanotherfinallysequencesequencesequencescoreritemResponseitemessayRubricconceptitemOutcomescorerconceptessayRubricitemitemOutcomeitemResponsescoreritemResponseitemessayRubricconceptitemOutcome
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)
-
-
-getItem()
-
-
-item
-
-
-getRubric()
-
-
-rubric
-
-
-applyTo(essayResp)
-
-
-match(essayResponse)
-
-
-score
-
-
-new
-
-
-getNormalMinimum()
-
-
-getNormalMaximum()
-
-
-setScore(score)
-
-
-setFeedback(missingConcepts)a_shapea_sequenceanotherfinallysequencesequencesequencescoreritemResponseitemessayRubricconceptitemOutcomescorerconceptessayRubricitemitemOutcomeitemResponsescoreritemResponseitemessayRubricconceptitemOutcome getItem()itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)getItem()itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)scorenewgetNormalMinimum()getNormalMaximum()setScore(score)setFeedback(missingConcepts)