From d9896d46730a2a54daa8e0736376a0a8ff4a43cd Mon Sep 17 00:00:00 2001 From: Starla Huang Date: Thu, 4 Jan 2024 16:14:08 +0800 Subject: [PATCH] #3786 fix getting valid attachment point logic for sugar --- packages/ketcher-core/src/domain/entities/Sugar.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/ketcher-core/src/domain/entities/Sugar.ts b/packages/ketcher-core/src/domain/entities/Sugar.ts index e6b65fd78c..c497b70c20 100644 --- a/packages/ketcher-core/src/domain/entities/Sugar.ts +++ b/packages/ketcher-core/src/domain/entities/Sugar.ts @@ -74,6 +74,13 @@ export class Sugar extends BaseMonomer { return 'R2'; } + if ( + otherMonomer.isAttachmentPointExistAndFree('R2') && + this.isAttachmentPointExistAndFree('R1') + ) { + return 'R1'; + } + if ( !otherMonomer.isAttachmentPointExistAndFree('R1') && this.isAttachmentPointExistAndFree('R1')