From 9d0d566342327c4d905f21bd97fe1e4104ac02fb Mon Sep 17 00:00:00 2001 From: guchigow Date: Thu, 13 Jun 2024 16:57:18 +0500 Subject: [PATCH] #4782 - It is possible to attach bond to attachment point label --- .../src/script/editor/tool/bond.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/ketcher-react/src/script/editor/tool/bond.ts b/packages/ketcher-react/src/script/editor/tool/bond.ts index 15e2dd5f49..76947b7a0e 100644 --- a/packages/ketcher-react/src/script/editor/tool/bond.ts +++ b/packages/ketcher-react/src/script/editor/tool/bond.ts @@ -25,6 +25,7 @@ import { fromOneBondDeletion, Struct, vectorUtils, + Atom, } from 'ketcher-core'; import Editor from '../Editor'; @@ -333,12 +334,18 @@ class BondTool implements Tool { this.editor.update(bondAddition[0]); } else if (dragCtx.item.map === 'atoms') { // click on atom - this.editor.update( - fromBondAddition(render.ctab, this.bondProps, dragCtx.item.id, { - label: 'C', - })[0], + const isAtomSuperatomLeavingGroup = Atom.isSuperatomLeavingGroupAtom( + struct, + dragCtx.item.id, ); - delete this.dragCtx.existedBond; + if (!isAtomSuperatomLeavingGroup) { + this.editor.update( + fromBondAddition(render.ctab, this.bondProps, dragCtx.item.id, { + label: 'C', + })[0], + ); + delete this.dragCtx.existedBond; + } } else if (dragCtx.item.map === 'bonds') { const bondProps = Object.assign({}, this.bondProps); const bond = struct.bonds.get(dragCtx.item.id) as Bond;