diff --git a/SBOLCanvasFrontend/src/app/graph-helpers.ts b/SBOLCanvasFrontend/src/app/graph-helpers.ts index d8a73a6..c5268f4 100644 --- a/SBOLCanvasFrontend/src/app/graph-helpers.ts +++ b/SBOLCanvasFrontend/src/app/graph-helpers.ts @@ -1891,6 +1891,22 @@ export class GraphHelpers extends GraphBase { return false } + /** + * Returns true if there is a Chromosomal Locus or Circular Backbone + * in the current graph view + */ + protected atLeastOneCircularOrChromosomalInGraph() { + let allGraphCells = this.graph.getDefaultParent().children + if (allGraphCells != null) { + for (let i = 0; i < allGraphCells.length; i++) { + if (allGraphCells[i].hasCircularBackbone() || allGraphCells[i].hasChromosomalLocus()) { + return true + } + } + } + return false + } + /** * Made specifically for undo, since it does not affect glyph info. * Removes "Circular" from the "otherTypes" property of Circuit Containers. diff --git a/SBOLCanvasFrontend/src/app/graph.service.ts b/SBOLCanvasFrontend/src/app/graph.service.ts index e17c271..bb80f1d 100644 --- a/SBOLCanvasFrontend/src/app/graph.service.ts +++ b/SBOLCanvasFrontend/src/app/graph.service.ts @@ -1526,6 +1526,12 @@ export class GraphService extends GraphHelpers { var bounds = this.graph.getGraphBounds() var vs = this.graph.view.scale + // To prevent the plasmid edges from being cut off in exported images + if(this.atLeastOneCircularOrChromosomalInGraph()){ + bounds.x -= 50 + bounds.width += 100 + } + // Prepares SVG document that holds the output var svgDoc = mx.mxUtils.createXmlDocument() var root = (svgDoc.createElementNS != null) ? @@ -1580,6 +1586,12 @@ export class GraphService extends GraphHelpers { let bounds = this.graph.getGraphBounds() let vs = this.graph.view.scale + // To prevent the plasmid edges from being cut off in exported images + if(this.atLeastOneCircularOrChromosomalInGraph()){ + bounds.x -= 50 + bounds.width += 100 + } + let xmlDoc = mx.mxUtils.createXmlDocument() let root = xmlDoc.createElement('output') xmlDoc.appendChild(root)