diff --git a/packages/ketcher-core/src/domain/entities/BaseMonomer.ts b/packages/ketcher-core/src/domain/entities/BaseMonomer.ts index 789f5205a2..0e5756cd29 100644 --- a/packages/ketcher-core/src/domain/entities/BaseMonomer.ts +++ b/packages/ketcher-core/src/domain/entities/BaseMonomer.ts @@ -145,8 +145,11 @@ export abstract class BaseMonomer extends DrawingEntity { return Boolean(this.firstFreeAttachmentPoint); } - public isAttachmentPointExistAndFree(attachmentPoint: AttachmentPointName){ - return this.hasAttachmentPoint(attachmentPoint) && !this.isAttachmentPointUsed(attachmentPoint) + public isAttachmentPointExistAndFree(attachmentPoint: AttachmentPointName) { + return ( + this.hasAttachmentPoint(attachmentPoint) && + !this.isAttachmentPointUsed(attachmentPoint) + ); } public setRenderer(renderer: BaseMonomerRenderer) { diff --git a/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts b/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts index b07adeeff0..15d8aa6056 100644 --- a/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts +++ b/packages/ketcher-core/src/domain/entities/DrawingEntitiesManager.ts @@ -351,8 +351,11 @@ export class DrawingEntitiesManager { monomer.turnOnAttachmentPointsVisibility(); bond.firstMonomer.removePotentialBonds(); monomer.removePotentialBonds(); - const firstMonomerValidSourcePoint = bond.firstMonomer.getValidSourcePoint(monomer); - const secondMonomerValidTargetPoint = monomer.getValidTargetPoint(bond.firstMonomer); + const firstMonomerValidSourcePoint = + bond.firstMonomer.getValidSourcePoint(monomer); + const secondMonomerValidTargetPoint = monomer.getValidTargetPoint( + bond.firstMonomer, + ); bond.firstMonomer.setPotentialBond(firstMonomerValidSourcePoint, bond); monomer.setPotentialBond(secondMonomerValidTargetPoint, bond); const connectFirstMonomerOperation = new MonomerHoverOperation( diff --git a/packages/ketcher-core/src/domain/entities/Peptide.ts b/packages/ketcher-core/src/domain/entities/Peptide.ts index 28b689169d..f9a5e88eef 100644 --- a/packages/ketcher-core/src/domain/entities/Peptide.ts +++ b/packages/ketcher-core/src/domain/entities/Peptide.ts @@ -1,29 +1,36 @@ import { BaseMonomer } from './BaseMonomer'; export class Peptide extends BaseMonomer { - public getValidSourcePoint(monomer: BaseMonomer) { - - if (monomer.isAttachmentPointExistAndFree('R1') && this.isAttachmentPointExistAndFree('R2')) { - - return 'R2'; + if ( + monomer.isAttachmentPointExistAndFree('R1') && + this.isAttachmentPointExistAndFree('R2') + ) { + return 'R2'; + } + if ( + this.isAttachmentPointExistAndFree('R1') && + monomer.isAttachmentPointExistAndFree('R2') + ) { + return 'R1'; + } - } - if (this.isAttachmentPointExistAndFree('R1') && monomer.isAttachmentPointExistAndFree('R2') ) { - return 'R1'; - } - return this.firstFreeAttachmentPoint; } public getValidTargetPoint(monomer: BaseMonomer) { - - if (this.isAttachmentPointExistAndFree('R1') && monomer.isAttachmentPointExistAndFree('R2') ) { - return 'R1'; - } - if (monomer.isAttachmentPointExistAndFree('R1') && this.isAttachmentPointExistAndFree('R2')) { - return 'R2'; - } + if ( + this.isAttachmentPointExistAndFree('R1') && + monomer.isAttachmentPointExistAndFree('R2') + ) { + return 'R1'; + } + if ( + monomer.isAttachmentPointExistAndFree('R1') && + this.isAttachmentPointExistAndFree('R2') + ) { + return 'R2'; + } return this.firstFreeAttachmentPoint; }