1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-29 16:23:55 +00:00

Fix folder width growing with length of alias (#476)

This commit is contained in:
matthew16550 2021-10-31 14:25:28 +11:00
parent 2a4a75e5de
commit 0a6c4454cf

View File

@ -147,8 +147,7 @@ public class USymbolFolder extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder()); final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim); ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug); ug = symbolContext.apply(ug);
final Dimension2D dimName = showTitle ? name.calculateDimension(ug.getStringBounder()) final Dimension2D dimName = getDimName(ug.getStringBounder());
: new Dimension2DDouble(40, 15);
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.isShadowing(), drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.isShadowing(),
symbolContext.getRoundCorner()); symbolContext.getRoundCorner());
final Margin margin = getMargin(); final Margin margin = getMargin();
@ -159,8 +158,12 @@ public class USymbolFolder extends USymbol {
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + dimName.getHeight()))); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + dimName.getHeight())));
} }
private Dimension2D getDimName(StringBounder stringBounder) {
return showTitle ? name.calculateDimension(stringBounder) : new Dimension2DDouble(40, 15);
}
public Dimension2D calculateDimension(StringBounder stringBounder) { public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimName = name.calculateDimension(stringBounder); final Dimension2D dimName = getDimName(stringBounder);
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimName, dimStereo, dimLabel)); return getMargin().addDimension(Dimension2DDouble.mergeTB(dimName, dimStereo, dimLabel));
@ -195,4 +198,4 @@ public class USymbolFolder extends USymbol {
}; };
} }
} }