1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00

Fix calculating shield (margin) size for nodes that are targets of qualified associations (#1467)

This commit is contained in:
Dietrich Travkin 2023-07-24 15:05:33 +02:00
parent d7efa7e9a2
commit 38cb4811f7
2 changed files with 24 additions and 5 deletions

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.style.ISkinSimple;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.url.Url; import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.utils.Direction;
import net.sourceforge.plantuml.utils.LineLocation; import net.sourceforge.plantuml.utils.LineLocation;
public class Link extends WithLinkType implements Hideable, Removeable { public class Link extends WithLinkType implements Hideable, Removeable {
@ -541,4 +542,11 @@ public class Link extends WithLinkType implements Hideable, Removeable {
return opale; return opale;
} }
public final boolean hasKal1() {
return this.linkArg.getKal1() != null && !this.linkArg.getKal1().isEmpty();
}
public final boolean hasKal2() {
return this.linkArg.getKal2() != null && !this.linkArg.getKal2().isEmpty();
}
} }

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2024, Arnaud Roques * (C) Copyright 2009-2024, Arnaud Roques
* *
* Project Info: https://plantuml.com * Project Info: https://plantuml.com
* *
* If you like this project or if you find it useful, you can support us at: * If you like this project or if you find it useful, you can support us at:
* *
* https://plantuml.com/patreon (only 1$ per month!) * https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal * https://plantuml.com/paypal
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
* PlantUML is free software; you can redistribute it and/or modify it * PlantUML is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* *
*/ */
package net.sourceforge.plantuml.svek; package net.sourceforge.plantuml.svek;
@ -381,7 +381,18 @@ public class SvekNode implements Positionable, Hideable {
} }
public boolean isShielded() { public boolean isShielded() {
return shield().isZero() == false; if (this.shield != null) {
return this.shield.isZero() == false;
}
// Avoid calculating "shield" size through this.shield() before finishing creation of all SvekLines (#1467)
// Instead, only check if we will have a shield (size is irrelevant here)
// This node will have a shield if it is target of a qualified association (will have a qualifier label
// placed besides this type's bounding box.)
return this.leaf.getDiagram().getLinks().stream()
.filter(link -> link.getEntity1() == this.leaf || link.getEntity2() == this.leaf)
.anyMatch(link -> (this.leaf == link.getEntity1() && link.hasKal1())
|| (this.leaf == link.getEntity2() && link.hasKal2()));
} }
public void resetMoveSvek() { public void resetMoveSvek() {