From 402895685a9ad5bff1b8afc6ad6894230a5af006 Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Mon, 3 Jun 2024 19:56:31 +0200 Subject: [PATCH] #4734 - Preview: Monomers from macro mode are not erased by Erase tool in micro mode - unblocked monomers deletion in micro mode --- .../ketcher-core/src/application/editor/actions/erase.ts | 2 +- .../src/application/editor/operations/sgroup/index.ts | 1 + packages/ketcher-react/src/script/editor/tool/eraser.ts | 5 ----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/ketcher-core/src/application/editor/actions/erase.ts b/packages/ketcher-core/src/application/editor/actions/erase.ts index 47e30a3780..0dfaa53fba 100644 --- a/packages/ketcher-core/src/application/editor/actions/erase.ts +++ b/packages/ketcher-core/src/application/editor/actions/erase.ts @@ -144,7 +144,7 @@ export function fromFragmentDeletion(restruct, rawSelection) { selection.atoms.forEach((atomId) => { const sgroup = struct.getGroupFromAtomId(atomId); - if (sgroup) { + if (sgroup && sgroup.isSuperatomWithoutLabel) { const attachmentPoints = sgroup.getAttachmentPoints(); attachmentPoints.forEach((attachmentPoint) => { if ( diff --git a/packages/ketcher-core/src/application/editor/operations/sgroup/index.ts b/packages/ketcher-core/src/application/editor/operations/sgroup/index.ts index 51fd9f4ecb..28f994d7b6 100644 --- a/packages/ketcher-core/src/application/editor/operations/sgroup/index.ts +++ b/packages/ketcher-core/src/application/editor/operations/sgroup/index.ts @@ -115,6 +115,7 @@ class SGroupDelete extends BaseOperation { if (!sgroup) return; this.data.type = sgroup?.item?.type; this.data.pp = sgroup?.item?.pp; + this.data.oldSgroup = sgroup.item; if (sgroup?.item?.type === 'DAT' && sgroupData) { restruct.clearVisel(sgroupData.visel); diff --git a/packages/ketcher-react/src/script/editor/tool/eraser.ts b/packages/ketcher-react/src/script/editor/tool/eraser.ts index 244fba2e2c..f53d6797c1 100644 --- a/packages/ketcher-react/src/script/editor/tool/eraser.ts +++ b/packages/ketcher-react/src/script/editor/tool/eraser.ts @@ -25,7 +25,6 @@ import { fromSimpleObjectDeletion, fromTextDeletion, FunctionalGroup, - MonomerMicromolecule, SGroup, } from 'ketcher-core'; @@ -345,10 +344,6 @@ class EraserTool implements Tool { ) { const sGroup = sgroups.get(ci.id); - if (sGroup?.item instanceof MonomerMicromolecule) { - return; - } - this.editor.update( fromFragmentDeletion(rnd.ctab, { atoms: [...SGroup.getAtoms(molecule, sGroup?.item)],