changeset 3336:db1dc197dc43

client: diagram-template: cleanup * add default values to diagramtitle element * fix positioning of title element
author Fadi Abbud <fadi.abbud@intevation.de>
date Mon, 20 May 2019 17:40:16 +0200
parents 59db0b5921c5
children 146bf3a1752c
files client/src/components/gauge/HydrologicalConditions.vue client/src/lib/mixins.js
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/gauge/HydrologicalConditions.vue	Mon May 20 17:34:43 2019 +0200
+++ b/client/src/components/gauge/HydrologicalConditions.vue	Mon May 20 17:40:16 2019 +0200
@@ -240,9 +240,9 @@
                 this.longtermInterval.join(" - ");
               this.addDiagramTitle(
                 e.position,
-                e.offset,
-                e.fontsize,
-                e.color,
+                e.offset || defaultOffset,
+                e.fontsize || defaultFontSize,
+                e.color || defaultColor,
                 gaugeInfo
               );
               break;
--- a/client/src/lib/mixins.js	Mon May 20 17:34:43 2019 +0200
+++ b/client/src/lib/mixins.js	Mon May 20 17:40:16 2019 +0200
@@ -156,7 +156,7 @@
     addDiagramTitle(position, offset, size, color, text) {
       let x = offset.x,
         y = offset.y;
-
+      this.pdf.doc.setFontSize(size);
       let width =
         (this.pdf.doc.getStringUnitWidth(text) * size) / (72 / 25.6) + size / 2;
       // if position is on the right, x needs to be calculate with pdf width and
@@ -168,7 +168,6 @@
         y = this.pdf.height - offset.y - this.getTextHeight(1);
       }
       this.pdf.doc.setTextColor(color);
-      this.pdf.doc.setFontSize(size);
       this.pdf.doc.setFontStyle("bold");
       this.pdf.doc.text(text, x, y, { baseline: "hanging" });
     },