changeset 2219:80de3787cdb3 pdf-export

removed unnecessary else block
author Markus Kottlaender <markus@intevation.de>
date Fri, 08 Feb 2019 16:21:29 +0100
parents 631ca0412db9
children d926292d81b6
files client/src/components/Pdftool.vue
diffstat 1 files changed, 20 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Fri Feb 08 16:16:04 2019 +0100
+++ b/client/src/components/Pdftool.vue	Fri Feb 08 16:21:29 2019 +0100
@@ -280,11 +280,17 @@
                 break;
               }
               case "bottleneck": {
-                this.addBottleneckInfo(e.position, e.offset);
+                this.addBottleneckInfo(
+                  e.position,
+                  e.offset
+                );
                 break;
               }
               case "legend": {
-                this.addLegend(e.position, e.offset);
+                this.addLegend(
+                  e.position,
+                  e.offset
+                );
                 break;
               }
               case "scalebar": {
@@ -299,9 +305,6 @@
           });
 
           this.pdf.doc.save("map.pdf");
-        } else {
-          this.addScaleBar(scaleNominator, "bottomright", { x: 2, y: 2 });
-          this.pdf.doc.save("map.pdf");
         }
         // reset to original size
         map.setSize(mapSize);
@@ -468,7 +471,8 @@
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
         y1 = this.pdf.height - offset.y - size;
       }
-
+      
+      
       var y2 = y1 + size * 3;
       var x3 = x1 - size * 2;
       var y3 = y1 + size * 5;
@@ -526,7 +530,7 @@
       }
 
       this.addRoundedBox(x, y, width, height);
-
+      
       // replace placeholders
       if (text.includes("{date}")) {
         text = text.replace("{date}", new Date().toLocaleString(locale2));
@@ -556,7 +560,7 @@
       }
 
       this.addRoundedBox(x, y, width, height);
-
+      
       let image = new Image();
       image.src = url;
       this.pdf.doc.addImage(
@@ -568,10 +572,7 @@
       );
     },
     addLegend(position, offset) {
-      if (
-        this.selectedBottleneck &&
-        this.getLayerByName("Bottleneck isolines").isVisible
-      ) {
+      if (this.selectedBottleneck && this.getLayerByName("Bottleneck isolines").isVisible) {
         // transforming into an HTMLImageElement only to find out
         // the width x height of the legend image
         // FUTURE: find a better way to get the width and height
@@ -581,11 +582,11 @@
         let width = 54;
         let height = width / aspectRatio;
         let padding = 2;
-
+        
         // x/y defaults to offset for topleft corner (normal x/y coordinates)
         let x = offset.x;
         let y = offset.y;
-
+        
         // if position is on the right, x needs to be calculate with pdf width and
         // the size of the element
         if (["topright", "bottomright"].indexOf(position) !== -1) {
@@ -606,18 +607,15 @@
       }
     },
     addBottleneckInfo(position, offset) {
-      if (
-        this.selectedBottleneck &&
-        this.getLayerByName("Bottleneck isolines").isVisible
-      ) {
+      if (this.selectedBottleneck && this.getLayerByName("Bottleneck isolines").isVisible) {
         let width = 54;
         let height = 13;
         let padding = 5;
-
+        
         // x/y defaults to offset for topleft corner (normal x/y coordinates)
         let x = offset.x;
         let y = offset.y;
-
+        
         // if position is on the right, x needs to be calculate with pdf width and
         // the size of the element
         if (["topright", "bottomright"].indexOf(position) !== -1) {
@@ -641,7 +639,7 @@
         str = this.selectedBottleneck;
         this.pdf.doc.setFontStyle("bold");
         this.pdf.doc.text(x + padding + w, y + padding, str);
-
+        
         str = this.$gettext("Survey date") + ": ";
         w = this.pdf.doc.getTextWidth(str);
         this.pdf.doc.setFontStyle("italic");
@@ -649,7 +647,7 @@
         str = this.selectedSurvey.date_info;
         this.pdf.doc.setFontStyle("normal");
         this.pdf.doc.text(x + padding + w, y + padding + 3, str);
-
+        
         str = this.$gettext("Ref gauge") + ": ";
         w = this.pdf.doc.getTextWidth(str);
         this.pdf.doc.setFontStyle("italic");