From 8ce6534bc2503acb5ac2d88c4004c3043b968299 Mon Sep 17 00:00:00 2001 From: Matteo Hausner Date: Fri, 12 Apr 2024 18:28:06 +0200 Subject: [PATCH] SVG Export: set a fixed aspect ratio --- src/main/java/de/bwravencl/controllerbuddy/gui/Main.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java b/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java index d1b55c4c..c3674420 100644 --- a/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java +++ b/src/main/java/de/bwravencl/controllerbuddy/gui/Main.java @@ -1417,6 +1417,10 @@ public void exportVisualization(final File file) { final var headElement = htmlDocument.createElementNS(XMLConstants.XLINK_NAMESPACE_URI, "head"); htmlDocument.getDocumentElement().appendChild(headElement); + final var styleElement = htmlDocument.createElementNS(XMLConstants.XLINK_NAMESPACE_URI, "style"); + styleElement.setTextContent(".svg-div{aspect-ratio:2.5;margin-top:50px}"); + headElement.appendChild(styleElement); + final var titleElement = htmlDocument.createElementNS(XMLConstants.XLINK_NAMESPACE_URI, "title"); final var title = currentFile != null ? currentFile.getName() : strings.getString("UNTITLED"); titleElement.setTextContent(title); @@ -1447,8 +1451,7 @@ public void exportVisualization(final File file) { svgDivElement.setAttribute("id", svgDivElementId); svgDivElement.setAttribute("class", "svg-div"); - svgDivElement.setAttribute("style", - "margin-top:50px;display:" + (Profile.defaultMode.equals(mode) ? "block" : "none")); + svgDivElement.setAttribute("style", "display:" + (Profile.defaultMode.equals(mode) ? "block" : "none")); bodyElement.appendChild(svgDivElement); final var svgDocument = generateSvgDocument(mode, false);