super(originX, originY, horizontalAlignment, borderWidth, paddingX, paddingY, editable);
}
+ public TextElementHandler(double originX, double originY, Alignment horizontalAlignment, double borderWidth,
+ double paddingX, double paddingY, boolean editable, double scale) {
+ super(originX, originY, horizontalAlignment, borderWidth, paddingX, paddingY, editable, scale);
+ }
- @Override
+ @Override
public Rectangle2D getBounds(IElement e, Rectangle2D size) {
- return calculateBounds(e, size, horizontalAlignment, SCALE, paddingX, paddingY);
+ return calculateBounds(e, size, horizontalAlignment, scale, paddingX, paddingY);
}
public static Rectangle2D calculateBounds(
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;
protected final boolean editable;
protected final double paddingX;
protected final double paddingY;
+ protected final double scale;
public TextElementNoBounds() {
}
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");
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);
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());