From d8c80f411083e317807c2d256e2d6c79e224f305 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Thu, 7 Apr 2022 18:53:33 +0200 Subject: [PATCH] Bug fix --- .../plantuml/graphic/FontConfiguration.java | 17 ++++++++------ .../sourceforge/plantuml/svek/SvekLine.java | 23 ++++++++++--------- .../sourceforge/plantuml/version/Version.java | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index 4d570325c..1b4d59aac 100644 --- a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java +++ b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java @@ -70,14 +70,15 @@ public class FontConfiguration { return getFont().toStringDebug() + " " + styles.toString(); } - public static FontConfiguration create(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink) { + public static FontConfiguration create(UFont font, HColor color, HColor hyperlinkColor, + boolean useUnderlineForHyperlink) { return create(font, color, hyperlinkColor, useUnderlineForHyperlink, 8); } - public static FontConfiguration create(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink, - int tabSize) { - return new FontConfiguration(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, new SvgAttributes(), false, - hyperlinkColor, useUnderlineForHyperlink, tabSize); + public static FontConfiguration create(UFont font, HColor color, HColor hyperlinkColor, + boolean useUnderlineForHyperlink, int tabSize) { + return new FontConfiguration(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, + new SvgAttributes(), false, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public static FontConfiguration blackBlueTrue(UFont font) { @@ -91,10 +92,12 @@ public class FontConfiguration { } public static FontConfiguration create(ISkinParam skinParam, Style style) { - // User getStyle().getFontConfiguration(skinParam.getIHtmlColorSet()) instead ? + final HColor hyperlinkColor = style.value(PName.HyperLinkColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + final boolean useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); return create(style.getUFont(), style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()), - skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); + hyperlinkColor, useUnderlineForHyperlink, skinParam.getTabSize()); } // --- diff --git a/src/net/sourceforge/plantuml/svek/SvekLine.java b/src/net/sourceforge/plantuml/svek/SvekLine.java index 6dfa70a18..e2246731d 100644 --- a/src/net/sourceforge/plantuml/svek/SvekLine.java +++ b/src/net/sourceforge/plantuml/svek/SvekLine.java @@ -625,6 +625,14 @@ public class SvekLine implements Moveable, Hideable, GuideLine { if (opale) return; + if (link.isInvis()) + return; + + if (dotPath == null) { + Log.info("DotPath is null for " + this); + return; + } + ug.draw(link.commentForSvg()); final Map typeIDent = new EnumMap<>(UGroupType.class); typeIDent.put(UGroupType.CLASS, @@ -648,9 +656,6 @@ public class SvekLine implements Moveable, Hideable, GuideLine { x += dx; y += dy; - if (link.isInvis()) - return; - if (this.link.getColors() != null) { final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); if (newColor != null) @@ -669,10 +674,6 @@ public class SvekLine implements Moveable, Hideable, GuideLine { ug = ug.apply(stroke); // double moveEndY = 0; - if (dotPath == null) { - Log.info("DotPath is null for " + this); - return; - } DotPath todraw = dotPath; if (link.getEntity2().isGroup() && link.getEntity2().getUSymbol() instanceof USymbolFolder) { final Cluster endCluster = bibliotekon.getCluster((IGroup) link.getEntity2()); @@ -738,7 +739,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine { final Set bez = dotPath.sample(); Point2D minPt = null; double minDist = Double.MAX_VALUE; - for (Point2D pt : square) { + for (Point2D pt : square) for (Point2D pt2 : bez) { final double distance = pt2.distance(pt); if (minPt == null || distance < minDist) { @@ -746,7 +747,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine { minDist = distance; } } - } + link.getLinkConstraint().setPosition(link, minPt); link.getLinkConstraint().drawMe(ug, skinParam); } @@ -769,9 +770,9 @@ public class SvekLine implements Moveable, Hideable, GuideLine { private String uniq(final Set ids, final String comment) { boolean changed = ids.add(comment); - if (changed) { + if (changed) return comment; - } + int i = 1; while (true) { final String candidate = comment + "-" + i; diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 658a3a21e..b2f8922d9 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 1; + final int beta = 2; return beta; }