Skip to content

Commit c46385d

Browse files
Copilotjongalloway
andauthored
fix: address code review comments - spelling, doc clarity, halfRow consistency
Agent-Logs-Url: https://github.com/jongalloway/DiagramForge/sessions/105be76e-e00b-4f8a-ae9d-01ea5b8ccb4e Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
1 parent c083682 commit c46385d

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/DiagramForge/Layout/DefaultLayoutEngine.Sequence.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private static void LayoutSequenceDiagram(
115115
int startIdx = Convert.ToInt32(startIdxObj, System.Globalization.CultureInfo.InvariantCulture);
116116
int endIdx = Convert.ToInt32(endIdxObj, System.Globalization.CultureInfo.InvariantCulture);
117117

118+
double halfRow = messageRowHeight / 2;
118119
double bandTop = double.MaxValue;
119120
double bandBottom = double.MinValue;
120121

@@ -134,14 +135,13 @@ private static void LayoutSequenceDiagram(
134135
if (y < bandTop) bandTop = y;
135136
// Use y + rowH - halfRow so consecutive bands meet at a shared
136137
// midpoint rather than overlapping.
137-
double rowBottom = y + rowH - messageRowHeight / 2;
138+
double rowBottom = y + rowH - halfRow;
138139
if (rowBottom > bandBottom) bandBottom = rowBottom;
139140
}
140141

141142
if (bandTop == double.MaxValue)
142143
continue; // no enclosed messages found
143144

144-
double halfRow = messageRowHeight / 2;
145145
group.X = 0;
146146
group.Y = bandTop - halfRow;
147147
group.Width = canvasWidth;

src/DiagramForge/Parsers/Mermaid/MermaidSequenceParser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ Node GetOrCreateParticipant(string id)
150150
/// Validates and normalises a rect color specification of the form
151151
/// <c>rgb(R,G,B)</c> or <c>rgba(R,G,B,A)</c>.
152152
/// Returns <see langword="false"/> when the input does not match either form.
153+
/// Only the structural prefix (<c>rgb(</c> / <c>rgba(</c>) and closing
154+
/// parenthesis are validated; individual component values are passed through as-is.
153155
/// </summary>
154156
private static bool TryParseRectColor(string colorSpec, out string normalizedColor)
155157
{

src/DiagramForge/Rendering/SvgStructureWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ private static void AppendSequenceRectBand(StringBuilder sb, Group group)
553553

554554
// For rgb() (no embedded alpha) add a fill-opacity so the band is
555555
// semi-transparent. For rgba() the caller-supplied alpha takes effect
556-
// automatically via the browser's CSS colour parsing.
556+
// automatically via the browser's CSS color parsing.
557557
bool hasEmbeddedAlpha = colorSpec.StartsWith("rgba(", StringComparison.OrdinalIgnoreCase);
558558
string opacityAttr = hasEmbeddedAlpha ? string.Empty : " fill-opacity=\"0.2\"";
559559

0 commit comments

Comments
 (0)