changeset 4000:c40f8b026de3

clinet: pdf-gen: fix positioning of text for template-textbox element
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 18 Jul 2019 12:50:33 +0200
parents ffc822700056
children bf86f9a08733
files client/src/lib/mixins.js
diffstat 1 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Wed Jul 17 18:39:18 2019 +0200
+++ b/client/src/lib/mixins.js	Thu Jul 18 12:50:33 2019 +0200
@@ -337,10 +337,7 @@
         x = this.pdf.width - offset.x - width;
       }
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-        y =
-          this.pdf.height -
-          offset.y * 0.3 -
-          this.getTextHeight(textLines.length);
+        y = this.pdf.height - offset.y - this.getTextHeight(textLines.length);
       }
       this.pdf.doc.text(textLines, x, y, { baseline: "hanging" });
     },
@@ -468,14 +465,25 @@
         background,
         brcolor
       );
-      this.addText(
-        position,
-        { x: offset.x + padding, y: offset.y + padding * 2 },
-        textWidth,
-        fontSize,
-        color,
-        text
-      );
+      if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
+        this.addText(
+          position,
+          { x: offset.x + padding, y: offset.y - padding / 2 },
+          textWidth,
+          fontSize,
+          color,
+          text
+        );
+      } else {
+        this.addText(
+          position,
+          { x: offset.x + padding, y: offset.y + padding * 2 },
+          textWidth,
+          fontSize,
+          color,
+          text
+        );
+      }
     }
   }
 };