Skip to content

Commit

Permalink
Redo will add the circular type to the circuit container if redoing b…
Browse files Browse the repository at this point in the history
…rought back a circular backbone
  • Loading branch information
Drock54651 committed Sep 24, 2024
1 parent d4d29cc commit b8cf17f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 16 additions & 0 deletions SBOLCanvasFrontend/src/app/graph-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,22 @@ export class GraphHelpers extends GraphBase {
}
}

/**
* Made specifically for redo.
* Adds the circular type back to Circuit Container if circular is present again.
*/
protected addCircularType() {
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
otherTypes.push("Circular")
}
}
}
}

protected flipInteractionEdge(cell) {
if (!cell.isInteraction()) {
console.error("flipInteraction attempted on something other than an interaction!")
Expand Down
10 changes: 6 additions & 4 deletions SBOLCanvasFrontend/src/app/graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ export class GraphService extends GraphHelpers {

// If the undo caused scars to become visible, we should update
this.showingScars = this.getScarsVisible()

// Add Circular type property back if needed
this.addCircularType()

// refresh to update cell labels
if (this.graph.getCurrentRoot()) {
Expand Down Expand Up @@ -653,10 +656,9 @@ export class GraphService extends GraphHelpers {

const childCellName = childCell.style.split("Glyph")[1]?.split(";")[0]?.trim()

// A circular backbone is considered a sequence feature
// "Cir (Circular Backbone Right/Left)" refers to the connection to the backbone
// It's possible to have a circular backbone as a standalone glyph
if(!childCell.isCircularBackbone() || childCellName === "Cir (Circular Backbone)"){
// Circular Backbone be added after all other children are created
// Prevents both the left and right side from being added
if(!childCell.isCircularBackbone()){
this.addSequenceFeature(childCellName)
}

Expand Down

0 comments on commit b8cf17f

Please sign in to comment.