From 1adac9d89fd3ae56be664ee4b27ec0ce5bbd3f31 Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Wed, 24 Jul 2024 08:31:44 +0200 Subject: [PATCH] lsp: remove outermost padding to remove border when exporting SVGs. Fixes #46. --- .../src/de/cau/cs/kieler/klighd/lsp/KGraphLayoutEngine.xtend | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLayoutEngine.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLayoutEngine.xtend index ff598dc4e..c600be067 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLayoutEngine.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLayoutEngine.xtend @@ -24,6 +24,8 @@ import de.cau.cs.kieler.klighd.lsp.utils.RenderingPreparer import java.io.ByteArrayOutputStream import java.util.ArrayList import org.apache.log4j.Logger +import org.eclipse.elk.core.math.ElkPadding +import org.eclipse.elk.core.options.CoreOptions import org.eclipse.elk.graph.ElkNode import org.eclipse.emf.common.util.URI import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl @@ -70,6 +72,8 @@ class KGraphLayoutEngine extends ElkLayoutEngine { */ def onlyLayoutOnKGraph(String uri) { val kGraphContext = diagramState.getKGraphContext(uri) + // Remove any padding from the root node to avoid blank padding around the edge of the entire graph. + kGraphContext.viewModel.setProperty(CoreOptions.PADDING, new ElkPadding(0)) // layout of KGraph val lightDiagramLayoutConfig = new LightDiagramLayoutConfig(kGraphContext)