changeset 3343:13bb0ff62ac8

client: diagram-template: cleanup (waterlevel) * remove unnecessary function * imrove positioning of diagram legend
author Fadi Abbud <fadi.abbud@intevation.de>
date Tue, 21 May 2019 09:52:01 +0200
parents 8c435f9a85bb
children 107de6def0c3
files client/src/components/gauge/Waterlevel.vue
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue	Mon May 20 18:57:47 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Tue May 21 09:52:01 2019 +0200
@@ -390,28 +390,21 @@
       }
       this.pdf.doc.addImage(imgData, "PNG", x, y, width, height);
     },
-    // Gauge info as a title for pdf
-
-    getTextHeight(numberOfLines) {
-      return (
-        numberOfLines *
-        ((this.pdf.doc.getFontSize() * 25.4) / 80) *
-        this.pdf.doc.getLineHeightFactor()
-      );
-    },
     // Diagram legend
     addDiagramLegend(position, offset, color) {
       let x = offset.x;
       let y = offset.y;
-      let width = this.pdf.doc.getTextWidth("Navigable Range") + 12;
-      let height = 15;
+      this.pdf.doc.setFontSize(10);
+      let width =
+        (this.pdf.doc.getStringUnitWidth("Navigable Range") * 10) /
+          (72 / 25.6) +
+        5;
       if (["topright", "bottomright"].indexOf(position) !== -1) {
         x = this.pdf.width - offset.x - width;
       }
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-        y = this.pdf.height - offset.y - height;
+        y = this.pdf.height - offset.y - this.getTextHeight(4);
       }
-      this.pdf.doc.setFontSize(10);
       this.pdf.doc.setTextColor(color);
       this.pdf.doc.setDrawColor("white");
       this.pdf.doc.setFillColor("steelblue");