X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Felements%2FTextElementNoBounds.java;h=376fadc06c9a40cab935eafb421e6e4534510328;hp=6959e8c439f2bbd4d942eae1137682e687952015;hb=c24439ef11722e3a652f0fb670d38e3d911142d9;hpb=4bc25acb8086df68836950af08faeacd382e5427 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementNoBounds.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementNoBounds.java index 6959e8c43..376fadc06 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementNoBounds.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementNoBounds.java @@ -49,7 +49,7 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent { protected static final double DEFAULT_PADDING_X = 0.5; protected static final double DEFAULT_PADDING_Y = 0.5; - protected static final double SCALE = 0.235; + protected static final double DEFAULT_SCALE = 0.235; protected final double originX; protected final double originY; @@ -59,6 +59,7 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent { protected final boolean editable; protected final double paddingX; protected final double paddingY; + protected final double scale; public TextElementNoBounds() { @@ -74,6 +75,10 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent { } public TextElementNoBounds(double originX, double originY, Alignment horizontalAlignment, double borderWidth, double paddingX, double paddingY, boolean editable) { + this(originX, originY, horizontalAlignment, borderWidth, paddingX, paddingY, editable, DEFAULT_SCALE); + } + + public TextElementNoBounds(double originX, double originY, Alignment horizontalAlignment, double borderWidth, double paddingX, double paddingY, boolean editable, double scale) { if (horizontalAlignment == null) throw new NullPointerException("null horizontal alignment"); @@ -85,9 +90,9 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent { this.editable = editable; this.paddingX = paddingX; this.paddingY = paddingY; + this.scale = scale; } - @Override public void init(final IElement e, G2DParentNode parent) { TextNode node = getOrCreateTextNode(e, parent); @@ -102,7 +107,7 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent { Alignment vAlign = ElementUtils.getHintOrDefault(e, ElementHints.KEY_VERTICAL_ALIGN, verticalAlignment); Double borderWidth = ElementUtils.getHintOrDefault(e, MonitorClass.KEY_BORDER_WIDTH, this.borderWidth); - node.init(text, font, color, originX, originY, SCALE); + node.init(text, font, color, originX, originY, scale); node.setBackgroundColor(fillColor); node.setBorderColor(borderColor); node.setHorizontalAlignment((byte) hAlign.ordinal());