diff --git a/packages/ketcher-core/src/application/render/restruct/reatom.ts b/packages/ketcher-core/src/application/render/restruct/reatom.ts index 51c875a75e..0bcbf828c4 100644 --- a/packages/ketcher-core/src/application/render/restruct/reatom.ts +++ b/packages/ketcher-core/src/application/render/restruct/reatom.ts @@ -574,35 +574,21 @@ function shouldDisplayStereoLabel( ignoreChiralFlag, flag: StereoFlag | undefined, ): boolean { - if (!stereoLabel) { + if (!stereoLabel || ignoreChiralFlag) { return false; } - const stereoLabelType = stereoLabel.match(/\D+/g)[0]; - - const stereoLabelTypeWithChiralFlag = ignoreChiralFlag - ? StereoLabel.Abs - : stereoLabelType; - if (stereoLabelTypeWithChiralFlag === StereoLabel.Abs) { - return false; - } - if (stereoLabelTypeWithChiralFlag === StereoLabel.And) { - return true; - } + const stereoLabelType = stereoLabel.match(/\D+/g)[0]; switch (labelStyle) { - // Off case StereLabelStyleType.Off: return false; - // On case StereLabelStyleType.On: return true; - // Classic case StereLabelStyleType.Classic: return !!( flag === StereoFlag.Mixed || stereoLabelType === StereoLabel.Or ); - // IUPAC case StereLabelStyleType.IUPAC: return !!( flag === StereoFlag.Mixed && stereoLabelType !== StereoLabel.Abs diff --git a/packages/ketcher-core/src/application/render/restruct/reenhancedFlag.ts b/packages/ketcher-core/src/application/render/restruct/reenhancedFlag.ts index 34f957b6a0..4ba5d04c44 100644 --- a/packages/ketcher-core/src/application/render/restruct/reenhancedFlag.ts +++ b/packages/ketcher-core/src/application/render/restruct/reenhancedFlag.ts @@ -57,7 +57,17 @@ class ReEnhancedFlag extends ReObject { show(restruct: ReStruct, fragmentId: number, options: any): void { const render = restruct.render; const fragment = restruct.molecule.frags.get(fragmentId); - if (!fragment?.enhancedStereoFlag) return; + const stereoFlag = fragment?.enhancedStereoFlag; + + if (!stereoFlag) { + return; + } + + // We don't want to show the ovarall label (flag) in case there are different types + // of stereo labels inside the structure ("mixed" and "or" stereo flags indicate that) + if (stereoFlag === StereoFlag.Mixed || stereoFlag === StereoFlag.Or) { + return; + } const position = fragment.stereoFlagPosition ? fragment.stereoFlagPosition @@ -75,13 +85,7 @@ class ReEnhancedFlag extends ReObject { if (options.showStereoFlags && !options.ignoreChiralFlag) { this.#path = paper - .text( - ps.x, - ps.y, - fragment.enhancedStereoFlag - ? stereoFlagMap[fragment.enhancedStereoFlag] - : '', - ) + .text(ps.x, ps.y, stereoFlag ? stereoFlagMap[stereoFlag] : '') .attr({ font: options.font, 'font-size': options.fontsz,