From d700998f11dafe2bf829a40b65490c1e71b6e516 Mon Sep 17 00:00:00 2001 From: nickmcdowall Date: Wed, 23 Mar 2022 17:35:36 +0000 Subject: [PATCH] fix: Hide svg elements when fully zoomed out #60 Some spacing was left over due to the
 tag which was preserving the empty space event even when an element was hidden.
Also adding display:block styling to the svg elements to prevent multiple diagrams on the same line when they are being shrunk
---
 src/main/resources/static/custom.js                  |  2 +-
 src/main/resources/templates/html-report.hbs         |  2 +-
 ...createsReportWithScenariosAndEvents.approved.html | 12 ++++++------
 ...tTest.diagramIsSplitOnNewPageEvents.approved.html |  4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/static/custom.js b/src/main/resources/static/custom.js
index b39262a..fad313d 100644
--- a/src/main/resources/static/custom.js
+++ b/src/main/resources/static/custom.js
@@ -33,7 +33,7 @@ function adjustSvgZoom(originalWidth, originalHeight, svg) {
             let newHeight = originalHeight / sliderValue;
             let newViewBox = '0 0 ' + newWidth + ' ' + newHeight;
             svg.attr("viewBox", newViewBox)
-            svg.attr("style", "") // remove inline styling which overrides height and width
+            svg.attr("style", "display:block;") // also removes inline styling of height and width
             svg.attr("width", originalWidth * sliderValue)
             svg.attr("height", originalHeight * sliderValue)
         }
diff --git a/src/main/resources/templates/html-report.hbs b/src/main/resources/templates/html-report.hbs
index 3a1d831..eb075e2 100644
--- a/src/main/resources/templates/html-report.hbs
+++ b/src/main/resources/templates/html-report.hbs
@@ -46,7 +46,7 @@
         {{#if sequenceDiagram}}
         

Sequence Diagram

-
{{{ sequenceDiagram.svg  }}}
+
{{{ sequenceDiagram.svg }}}