changeset 4486:e58fc3a62118

client: pdf-gen: improve code for textbox element
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 26 Sep 2019 14:21:49 +0200
parents 685a5fd3a2f3
children 80697ecc04e7
files client/src/lib/mixins.js
diffstat 1 files changed, 12 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Thu Sep 26 12:45:56 2019 +0200
+++ b/client/src/lib/mixins.js	Thu Sep 26 14:21:49 2019 +0200
@@ -503,28 +503,18 @@
         background,
         brcolor
       );
-      if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-        this.addText(
-          position,
-          { x: offset.x + padding, y: offset.y },
-          textWidth,
-          fontSize,
-          color,
-          text
-        );
-      } else {
-        this.addText(
-          position,
-          {
-            x: offset.x + padding,
-            y: offset.y + height - this.getTextHeight(textLines.length)
-          },
-          textWidth,
-          fontSize,
-          color,
-          text
-        );
-      }
+      let yForText =
+        ["bottomright", "bottomleft"].indexOf(position) !== -1
+          ? offset.y
+          : offset.y + height - this.getTextHeight(textLines.length);
+      this.addText(
+        position,
+        { x: offset.x + padding, y: yForText },
+        textWidth,
+        fontSize,
+        color,
+        text
+      );
     },
     dateForPDF() {
       return new Date()