From 1946733a898f72557cc37156ddd5e837c5f0468c Mon Sep 17 00:00:00 2001 From: Starla Huang Date: Fri, 2 Feb 2024 14:58:48 +0800 Subject: [PATCH] #3869 fix some comments issues --- .../Polymer-Bond-Tool/snake-bond-tool.spec.ts | 2 +- .../domain/entities/DrawingEntitiesManager.ts | 24 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ketcher-autotests/tests/Macromolecule-editor/Polymer-Bond-Tool/snake-bond-tool.spec.ts b/ketcher-autotests/tests/Macromolecule-editor/Polymer-Bond-Tool/snake-bond-tool.spec.ts index 26d5dc32eb..a825e870a7 100644 --- a/ketcher-autotests/tests/Macromolecule-editor/Polymer-Bond-Tool/snake-bond-tool.spec.ts +++ b/ketcher-autotests/tests/Macromolecule-editor/Polymer-Bond-Tool/snake-bond-tool.spec.ts @@ -103,7 +103,7 @@ test.describe('Snake Bond Tool', () => { await bondTwoMonomers(page, peptide2, peptide3); await bondTwoMonomers(page, peptide3, peptide4); - // await takeEditorScreenshot(page); + await takeEditorScreenshot(page); }); test('Check snake mode arrange for peptides chain', async ({ page }) => { diff --git a/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts b/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts index caa309b233..9f04847fa7 100644 --- a/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts +++ b/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts @@ -973,7 +973,7 @@ export class DrawingEntitiesManager { ); ({ lastPosition, maxVerticalDistance } = nextMonomerResult); - this.getRnaBaseSideChainMonomers( + this.setRnaBaseSideChainMonomers( nucleotide.rnaBase, rearrangedMonomersSet, monomersWithSideChain, @@ -1027,7 +1027,7 @@ export class DrawingEntitiesManager { return { command, lastPosition, maxVerticalDistance }; } - private getRnaBaseSideChainMonomers( + private setRnaBaseSideChainMonomers( rnaBase: RNABase, rearrangedMonomersSet: Set, monomersWithSideChain: Array, @@ -1311,12 +1311,11 @@ export class DrawingEntitiesManager { firstMonomers = [firstMonomerInR2R1Chain]; } else { const oldMonomerPosition = monomerWithSideChain.position; - const newMonomerPosition = getFirstPosition(90, lastPosition); const operation = new MonomerMoveOperation( this.rearrangeChainModelChange.bind( this, monomerWithSideChain, - Coordinates.canvasToModel(newMonomerPosition), + Coordinates.canvasToModel(lastPosition), ), this.rearrangeChainModelChange.bind( this, @@ -1326,7 +1325,10 @@ export class DrawingEntitiesManager { ); rearrangedMonomersSet.add(monomerWithSideChain.id); command.addOperation(operation); - lastPosition = getFirstPosition(90, newMonomerPosition); + const height = + (monomerWithSideChain.renderer?.monomerSize.height ?? 0) + + VERTICAL_DISTANCE_FROM_MONOMER; + lastPosition = getFirstPosition(height, lastPosition); } const rearrangeResult = this.reArrangeMonomers( @@ -1344,18 +1346,6 @@ export class DrawingEntitiesManager { return { command, lastPosition }; } - public getPhosphateFromRnaBase(baseMonomer: RNABase) { - const r1PolymerBond = baseMonomer.attachmentPointsToBonds.R1; - const sugarMonomer = r1PolymerBond?.getAnotherMonomer(baseMonomer); - if (sugarMonomer && sugarMonomer instanceof Sugar) { - const phosphate = getNextMonomerInChain(sugarMonomer); - if (phosphate && phosphate instanceof Phosphate) { - return phosphate; - } - } - return undefined; - } - public setMicromoleculesHiddenEntities(struct: Struct) { struct.mergeInto(this.micromoleculesHiddenEntities); this.micromoleculesHiddenEntities.atoms = new Pool();