From 78d156c316026506b5d881f7bc5d20718044dda6 Mon Sep 17 00:00:00 2001 From: Konstantin Levin Date: Wed, 31 May 2023 14:58:27 +0200 Subject: [PATCH] #2717 Tooltip for S-Group appears in upper left area of canvas --- packages/ketcher-core/src/domain/entities/sgroup.ts | 9 ++++++++- .../ui/views/components/StructEditor/InfoPanel.tsx | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/ketcher-core/src/domain/entities/sgroup.ts b/packages/ketcher-core/src/domain/entities/sgroup.ts index 826b84e3c7..eab98aa0c6 100644 --- a/packages/ketcher-core/src/domain/entities/sgroup.ts +++ b/packages/ketcher-core/src/domain/entities/sgroup.ts @@ -632,7 +632,14 @@ export class SGroup { if (!sGroup) { return false } - return sGroup.type === 'SUP' + return sGroup.type === SGroup.TYPES.SUP + } + + static isDataSGroup(sGroup) { + if (!sGroup) { + return false + } + return sGroup.type === SGroup.TYPES.DAT } static isExpandedSGroup(sGroup) { diff --git a/packages/ketcher-react/src/script/ui/views/components/StructEditor/InfoPanel.tsx b/packages/ketcher-react/src/script/ui/views/components/StructEditor/InfoPanel.tsx index 9cb6728c1c..18657214a3 100644 --- a/packages/ketcher-react/src/script/ui/views/components/StructEditor/InfoPanel.tsx +++ b/packages/ketcher-react/src/script/ui/views/components/StructEditor/InfoPanel.tsx @@ -95,7 +95,7 @@ const InfoPanel: FC = (props) => { const groupName = sGroup?.data?.name useEffect(() => { - if (!groupStruct && sGroup?.type === 'DAT') { + if (SGroup.isDataSGroup(sGroup)) { setSGroupData(`${sGroup.data?.fieldName}=${sGroup.data?.fieldValue}`) } else { setSGroupData(null) @@ -119,7 +119,9 @@ const InfoPanel: FC = (props) => { const width = size.x const height = size.y - return molecule ? ( + const showMolecule = molecule && !SGroup.isDataSGroup(sGroup) + + return showMolecule ? (