From b6a5270b9cca3419db0053a197a06cc67f2f0ed2 Mon Sep 17 00:00:00 2001 From: Nordes Menard-Lamarre Date: Thu, 7 Jan 2021 20:56:09 -0500 Subject: [PATCH] #437-Implement arrow style color --- .../plantuml/project/GanttDiagram.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index d818b430c..aa43b8541 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -91,6 +91,10 @@ import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.ImageParameter; @@ -288,10 +292,25 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit if (printStart != null && constraint.isHidden(min, max)) { continue; } - constraint.getUDrawable(timeScale, linksColor, this).drawU(ug); + + // If the linksColor is the default color, we should try to get the arrow color (default is RED_DARK) + if (linksColor == HColorUtils.RED_DARK) { + constraint.getUDrawable(timeScale, getLinkColor(), this).drawU(ug); + } else { + constraint.getUDrawable(timeScale, linksColor, this).drawU(ug); + } } } + private HColor getLinkColor() { + final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(getCurrentStyleBuilder()); + return styleArrow.value(PName.LineColor).asColor(colorSet); + } + + public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.ganttDiagram, SName.arrow); + } + private void drawTasksTitle(final UGraphic ug1) { for (Task task : tasks.values()) { if (isHidden(task)) { @@ -405,12 +424,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit first = first.getTrueRow(); } for (TaskDraw td : draws.values()) { - if (td == first) + if (td == first) { skipping = false; - if (skipping) + } + if (skipping) { continue; + } td.pushMe(deltaY + 1); - } }