From a0a50e2b51cdb95229e7f797a43b1f9e3e9ef160 Mon Sep 17 00:00:00 2001 From: shb0527 <111919818+shb0527@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:35:04 -0600 Subject: [PATCH] sequence feature without backbone --- .../app/glyph-menu/glyph-menu.component.ts | 3 ++- SBOLCanvasFrontend/src/app/graph.service.ts | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SBOLCanvasFrontend/src/app/glyph-menu/glyph-menu.component.ts b/SBOLCanvasFrontend/src/app/glyph-menu/glyph-menu.component.ts index 4ebad558..14bde38c 100644 --- a/SBOLCanvasFrontend/src/app/glyph-menu/glyph-menu.component.ts +++ b/SBOLCanvasFrontend/src/app/glyph-menu/glyph-menu.component.ts @@ -44,7 +44,8 @@ export class GlyphMenuComponent implements OnInit, AfterViewInit { } onSequenceFeatureGlyphClicked(name: string) { - this.graphService.addSequenceFeature(name); + //this.graphService.addSequenceFeature(name); + this.graphService.addSequenceFeatureWithoutBackbone(name); } onMolecularSpeciesGlyphClicked(name: string) { diff --git a/SBOLCanvasFrontend/src/app/graph.service.ts b/SBOLCanvasFrontend/src/app/graph.service.ts index dba02c7a..aa4e087b 100644 --- a/SBOLCanvasFrontend/src/app/graph.service.ts +++ b/SBOLCanvasFrontend/src/app/graph.service.ts @@ -753,7 +753,33 @@ export class GraphService extends GraphHelpers { this.graph.getModel().endUpdate(); } } + /** + * Creates sequence feature without backbone + */ + addSequenceFeatureWithoutBackbone(name){ + const pt = this.getDefaultNewCellCoords(); + this.addSequenceFeatureWithoutBackboneAt(name, pt.x, pt.y); +} + +addSequenceFeatureWithoutBackboneAt(name, x,y){ + this.graph.getModel().beginUpdate(); + try{ + const glyphInfo = new GlyphInfo({ + partRole: name + }); + this.addToInfoDict(glyphInfo); + + const sequenceFeatureCell = this.graph.insertVertex(this.graph.getDefaultParent(), null, glyphInfo.getFullURI(), x, y, GraphBase.sequenceFeatureGlyphWidth, GraphBase.sequenceFeatureGlyphHeight, GraphBase.STYLE_SEQUENCE_FEATURE + name); + this.createViewCell(glyphInfo.getFullURI()); + sequenceFeatureCell.setConnectable(true); + + this.graph.clearSelection(); + this.graph.setSelectionCell(sequenceFeatureCell) + } finally { + this.graph.getModel().endUpdate(); + } +} /** * Turns the given element into a dragsource for creating molecular species glyphs */