Skip to content

Commit

Permalink
SVG Export: set a fixed aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
bwRavencl committed Apr 12, 2024
1 parent 09390e9 commit 8ce6534
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/de/bwravencl/controllerbuddy/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8ce6534

Please sign in to comment.