From 568d8577b95cb58964e5a46f27b1bb864c483455 Mon Sep 17 00:00:00 2001 From: Nikita Chistousov Date: Thu, 8 Aug 2024 15:39:13 +0200 Subject: [PATCH] =?UTF-8?q?Backmerge:=20#5184=20=E2=80=93=20Fix=20unresolv?= =?UTF-8?q?ed=20monomers=20bond=20establishing=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ketcher-core/src/application/editor/tools/Bond.ts | 9 +++++++++ .../src/domain/entities/UnresolvedMonomer.ts | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/ketcher-core/src/application/editor/tools/Bond.ts b/packages/ketcher-core/src/application/editor/tools/Bond.ts index 93a7982115..2f95eff83d 100644 --- a/packages/ketcher-core/src/application/editor/tools/Bond.ts +++ b/packages/ketcher-core/src/application/editor/tools/Bond.ts @@ -28,6 +28,7 @@ import { Coordinates } from '../shared/coordinates'; import { AttachmentPointName } from 'domain/types'; import { AttachmentPoint } from 'domain/AttachmentPoint'; import { Command } from 'domain/entities/Command'; +import { UnresolvedMonomer } from "domain/entities"; class PolymerBond implements BaseTool { private bondRenderer?: PolymerBondRenderer; @@ -493,6 +494,14 @@ class PolymerBond implements BaseTool { return true; } + // Modal: Any or both monomers are unresolved + if ( + firstMonomer instanceof UnresolvedMonomer || + secondMonomer instanceof UnresolvedMonomer + ) { + return true; + } + // Modal: One monomer is Peptide and another is RNA monomer const rnaMonomerClasses = [Sugar, RNABase, Phosphate]; const firstMonomerIsRNA = rnaMonomerClasses.find( diff --git a/packages/ketcher-core/src/domain/entities/UnresolvedMonomer.ts b/packages/ketcher-core/src/domain/entities/UnresolvedMonomer.ts index b6b6611f11..c3314fc02f 100644 --- a/packages/ketcher-core/src/domain/entities/UnresolvedMonomer.ts +++ b/packages/ketcher-core/src/domain/entities/UnresolvedMonomer.ts @@ -2,14 +2,15 @@ import { BaseMonomer } from './BaseMonomer'; import { ChemSubChain } from 'domain/entities/monomer-chains/ChemSubChain'; import { PeptideSubChain } from 'domain/entities/monomer-chains/PeptideSubChain'; import { SubChainNode } from 'domain/entities/monomer-chains/types'; +import { Peptide } from 'domain/entities/Peptide'; export class UnresolvedMonomer extends BaseMonomer { - public getValidSourcePoint(_monomer?: BaseMonomer) { - return undefined; + public getValidSourcePoint(monomer?: BaseMonomer) { + return Peptide.prototype.getValidSourcePoint.call(this, monomer); } - public getValidTargetPoint(_monomer: BaseMonomer) { - return undefined; + public getValidTargetPoint(monomer: BaseMonomer) { + return Peptide.prototype.getValidTargetPoint.call(this, monomer); } public get SubChainConstructor() {