changeset 3500:5c4f117d8f98

diagram mixin: prevent null errors
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 28 May 2019 11:25:34 +0200
parents 3d273d76a963
children c5c7cc24fe72
files client/src/lib/mixins.js
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Tue May 28 11:16:53 2019 +0200
+++ b/client/src/lib/mixins.js	Tue May 28 11:25:34 2019 +0200
@@ -36,8 +36,8 @@
     getDimensions({ main, nav }) {
       //dimensions and margins
       const elem = document.querySelector("#" + this.containerId);
-      const svgWidth = elem ? elem.clientWidth : 0;
-      const svgHeight = elem ? elem.clientHeight : 0;
+      const svgWidth = elem != null ? elem.clientWidth : 0;
+      const svgHeight = elem != null ? elem.clientHeight : 0;
       const mainMargin = main || { top: 20, right: 20, bottom: 110, left: 80 };
       const navMargin = nav || {
         top: svgHeight - mainMargin.top - 65,