]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Allow customizing TextElement default vertical alignment 98/3898/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 21 Feb 2020 09:12:37 +0000 (11:12 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 21 Feb 2020 09:12:37 +0000 (11:12 +0200)
gitlab #471

Change-Id: I05ead92b16fe172672231bbc9a2ac0f7da5b9da6

bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementHandler.java
bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextElementNoBounds.java

index 192b0ea5d09588c783561dc1133d5ad571af5823..a50c190b9b27fdb13a2446bd89e6b36ee5c10214 100644 (file)
@@ -56,6 +56,12 @@ public class TextElementHandler extends TextElementNoBounds implements InternalS
                        double paddingX, double paddingY, boolean editable, double scale) {
                super(originX, originY, horizontalAlignment, borderWidth, paddingX, paddingY, editable, scale);
        }
+    
+       public TextElementHandler(double originX, double originY, Alignment horizontalAlignment,
+                       Alignment verticalAlignment, double borderWidth, double paddingX, double paddingY, boolean editable,
+                       double scale) {
+               super(originX, originY, horizontalAlignment, verticalAlignment, borderWidth, paddingX, paddingY, editable, scale);
+       }
 
        @Override
     public Rectangle2D getBounds(IElement e, Rectangle2D size) {
index 376fadc06c9a40cab935eafb421e6e4534510328..14bc7c1f69609777240310ca8cdf88f82c5bff1d 100644 (file)
@@ -79,13 +79,17 @@ public class TextElementNoBounds implements SceneGraph, HandleMouseEvent {
     }
     
     public TextElementNoBounds(double originX, double originY, Alignment horizontalAlignment, double borderWidth, double paddingX, double paddingY, boolean editable, double scale) {
+       this(originX, originY, horizontalAlignment, Alignment.BASELINE, borderWidth, paddingX, paddingY, editable, scale);
+    }
+    
+    public TextElementNoBounds(double originX, double originY, Alignment horizontalAlignment, Alignment verticalAlignment, double borderWidth, double paddingX, double paddingY, boolean editable, double scale) {
         if (horizontalAlignment == null)
             throw new NullPointerException("null horizontal alignment");
 
         this.originX = originX;
         this.originY = originY;
         this.horizontalAlignment = horizontalAlignment;
-        this.verticalAlignment = Alignment.BASELINE;
+        this.verticalAlignment = verticalAlignment;
         this.borderWidth = borderWidth;
         this.editable = editable;
         this.paddingX = paddingX;