Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SBOLCanvasBackend/src/utils/MxToSBOL.java
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ private void linkCombinatorial(SBOLDocument document, mxGraph graph, mxGraphMode
// because we don't have a good way of associating glyphs to components
// otherwise
mxCell variableCell = (mxCell) model.getCell(varCompInfo.getCellID());
if (variableCell == null || (variableCell.getStyle() != null && variableCell.getStyle().contains(STYLE_BACKBONE))) {
continue;
}
Component component = components.get(variableCell.getParent().getIndex(variableCell) - 1);
VariableComponent varComp = combDer.createVariableComponent(component.getDisplayId() + "_VariableComponent",
operator, component.getIdentity());
Expand Down
13 changes: 13 additions & 0 deletions SBOLCanvasFrontend/src/app/graph-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,19 @@ export class GraphBase {
}

layout.execute(this)

const backboneWidth = this.getBackbone().getGeometry().width
if (this.children) {
for (let child of this.children) {
if (child.stayAtBeginning) {
child.replaceGeometry(0, 'auto', 'auto', 'auto', graph)
} else if (child.stayAtEnd) {
const childWidth = child.getGeometry().width
const newX = Math.max(0, backboneWidth - childWidth)
child.replaceGeometry(newX, 'auto', 'auto', 'auto', graph)
}
}
}
}

mx.mxCell.prototype.refreshViewCell = function (graph) {
Expand Down
6 changes: 4 additions & 2 deletions SBOLCanvasFrontend/src/app/graph-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,12 @@ export class GraphHelpers extends GraphBase {
if (moduleInfo) {
this.metadataService.setSelectedModuleInfo(moduleInfo.makeCopy())
}
} else if ((!cell && this.graph.getCurrentRoot().isComponentView()) || (cell && (cell.isSequenceFeatureGlyph() || cell.isMolecularSpeciesGlyph() || cell.isCircuitContainer()))) {
} else if ((!cell && this.graph.getCurrentRoot().isComponentView()) || (cell && (cell.isSequenceFeatureGlyph() || cell.isMolecularSpeciesGlyph() || cell.isCircuitContainer() || cell.isBackbone()))) {
let glyphInfo
if (!cell)
glyphInfo = this.getFromInfoDict(this.graph.getCurrentRoot().getId());
else if (cell.isBackbone())
glyphInfo = this.getFromInfoDict(cell.getParent().value);
else
glyphInfo = this.getFromInfoDict(cell.value);

Expand Down Expand Up @@ -1239,7 +1241,7 @@ export class GraphHelpers extends GraphBase {
}

// combinatorial info
if (cell && cell.isSequenceFeatureGlyph()) {
if (cell && (cell.isSequenceFeatureGlyph() || cell.isBackbone())) {
let combinatorialInfo: CombinatorialInfo = this.getCombinatorialWithTemplate(cell.getParent().value)
if (!combinatorialInfo) {
combinatorialInfo = new CombinatorialInfo()
Expand Down
64 changes: 56 additions & 8 deletions SBOLCanvasFrontend/src/app/graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,50 @@ export class GraphService extends GraphHelpers {
})
}

private getPrimarySelectedCell() {
const selected = this.graph.getSelectionCells()
if (!selected || selected.length === 0) {
return null
}

if (selected.length === 1) {
return selected[0]
}

if (selected.length === 2) {
const anchored = selected.find(cell => cell.stayAtBeginning || cell.stayAtEnd)
if (anchored) {
return anchored
}
}

const glyph = selected.find(cell => cell.isSequenceFeatureGlyph && cell.isSequenceFeatureGlyph())
if (glyph) {
return glyph
}

const backbone = selected.find(cell => cell.isBackbone && cell.isBackbone())
if (backbone) {
return backbone
}

return selected[0]
}

isSelectedAGlyph(): boolean {
let selected = this.graph.getSelectionCells()
if (selected.length != 1) {
const selected = this.getPrimarySelectedCell()
if (!selected) {
return false
}
return selected[0].isSequenceFeatureGlyph()
return selected.isSequenceFeatureGlyph()
}

isSelectedBackbone(): boolean {
const selected = this.getPrimarySelectedCell()
if (!selected) {
return false
}
return selected.isBackbone()
}

isRootAComponentView(): boolean {
Expand Down Expand Up @@ -194,10 +232,20 @@ export class GraphService extends GraphHelpers {

getSelectedCellID(): string {
let selected = this.graph.getSelectionCells()
if (selected.length != 1) {
return null

if (selected.length === 1) {
return selected[0].getId()
}
return selected[0].getId()

if (selected.length === 2) {
try {
if (selected[1].stayAtBeginning)
return selected[1].getId()
} catch (e) {
}
}

return null
}

/**
Expand Down Expand Up @@ -1483,11 +1531,11 @@ export class GraphService extends GraphHelpers {
* @param prevURI
*/
setSelectedCombinatorialInfo(info: CombinatorialInfo, prevURI?: string) {
const selectedCell = this.graph.getSelectionCell()
const selectedCell = this.getPrimarySelectedCell()

this.graph.getModel().beginUpdate()
try {
if (info instanceof CombinatorialInfo && selectedCell.isSequenceFeatureGlyph()) {
if (info instanceof CombinatorialInfo && selectedCell && selectedCell.isSequenceFeatureGlyph()) {
if (!prevURI) {
prevURI = info.getFullURI()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class InfoEditorComponent implements OnInit {

isCombinatorialPossible(): boolean {
// TODO remove the check that root is a component when enumeration makes sense in module designs
return this.graphService.isSelectedAGlyph() && this.graphService.isRootAComponentView();
return (this.graphService.isSelectedAGlyph() || this.graphService.isSelectedBackbone()) && this.graphService.isRootAComponentView();
}

openCombinatorialDialog() {
Expand Down
4 changes: 2 additions & 2 deletions SBOLCanvasFrontend/src/environments/versions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// this file is automatically generated by git.version.js script
exports.versions = {
revision: '05262c4',
branch: 'kenzo',
revision: '7620979',
branch: 'backbone_combinatorial',
version: '1.4.0'
};