changeset 4416:5b2023c2c41e

pdftool: independent if cancel crashes, the cancel button should vanish
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 18 Sep 2019 12:15:27 +0200
parents 8dde014af77b
children ad7b06f2f2ad
files client/src/components/Pdftool.vue
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Wed Sep 18 11:32:29 2019 +0200
+++ b/client/src/components/Pdftool.vue	Wed Sep 18 12:15:27 2019 +0200
@@ -462,15 +462,18 @@
       );
     },
     cancel() {
-      this.openLayersMap().un(
-        this.rendercompleteListener.type,
-        this.rendercompleteListener.listener
-      );
-      this.openLayersMap().setSize(this.mapSize);
-      this.openLayersMap()
-        .getView()
-        .fit(this.resolution, { size: this.mapSize });
-      this.readyToGenerate = true;
+      try {
+        this.openLayersMap().un(
+          this.rendercompleteListener.type,
+          this.rendercompleteListener.listener
+        );
+        this.openLayersMap().setSize(this.mapSize);
+        this.openLayersMap()
+          .getView()
+          .fit(this.resolution, { size: this.mapSize });
+      } finally {
+        this.readyToGenerate = true;
+      }
     },
     // add the used map scale and papersize
     addScale(scaleDenominator, position, width, offset, fontSize, color) {