diff --git a/SBOLCanvasFrontend/src/app/graph-helpers.ts b/SBOLCanvasFrontend/src/app/graph-helpers.ts index 0529d12..2400765 100644 --- a/SBOLCanvasFrontend/src/app/graph-helpers.ts +++ b/SBOLCanvasFrontend/src/app/graph-helpers.ts @@ -1882,6 +1882,23 @@ export class GraphHelpers extends GraphBase { return false } + /** + * Made specifically for undo, since it does not affect glyph info. + * Removes "Circular" from the "otherTypes" property of Circuit Containers. + */ + protected removeCircularType() { + let allGraphCells = this.graph.getDefaultParent().children + if (allGraphCells != null) { + for (let i = 0; i < allGraphCells.length; i++) { + if (allGraphCells[i].isCircuitContainer() && !allGraphCells[i].isCircularBackboneOnCircuitContainer()) { + const otherTypes = this.getGlyphInfo(allGraphCells[i]).otherTypes + const index = otherTypes.indexOf("Circular") + otherTypes.splice(index, 1) + } + } + } + } + protected flipInteractionEdge(cell) { if (!cell.isInteraction()) { console.error("flipInteraction attempted on something other than an interaction!") diff --git a/SBOLCanvasFrontend/src/app/graph.service.ts b/SBOLCanvasFrontend/src/app/graph.service.ts index b0045b4..a5b693b 100644 --- a/SBOLCanvasFrontend/src/app/graph.service.ts +++ b/SBOLCanvasFrontend/src/app/graph.service.ts @@ -467,8 +467,14 @@ export class GraphService extends GraphHelpers { if (combinatorial) combinatorial.removeVariableComponentInfo(cell.getId()) - if (cell.stayAtBeginning || cell.stayAtEnd) cell.getParent().circularBackbone = false - + if (cell.stayAtBeginning || cell.stayAtEnd) { + cell.getParent().circularBackbone = false + + // remove the circular type from "otherTypes" since circular parts are deleted + const otherTypes = this.getGlyphInfo(cell.getParent()).otherTypes + const index = otherTypes.indexOf("Circular") + otherTypes.splice(index, 1) + } circuitContainers.push(cell.getParent()) } } else if (cell.isCircuitContainer() && this.graph.getCurrentRoot() && this.graph.getCurrentRoot().isComponentView()) @@ -554,6 +560,9 @@ export class GraphService extends GraphHelpers { this.graph.clearSelection() this.editor.execute('undo') + // Undo does not affect glyph info, if circular backbone is not present, remove it from "otherTypes" property + this.removeCircularType() + //console.log(this.editor.undoManager); // If the undo caused scars to become visible, we should update @@ -844,7 +853,9 @@ export class GraphService extends GraphHelpers { // Add additional type to Circuit Container if Circular present const circuitContainerGlyphInfo = (this.getGlyphInfo(circuitContainer)) - circuitContainerGlyphInfo.otherTypes.push("Circular") + if(!circuitContainerGlyphInfo.otherTypes.includes("Circular")){ + circuitContainerGlyphInfo.otherTypes.push("Circular") + } // there cannot be more than one circular backbone on a circuit container if(circuitContainer.isCircularBackboneOnCircuitContainer()) return