Skip to content

Commit

Permalink
#3208 - Fixed structure disappearance and app crash when pressing on …
Browse files Browse the repository at this point in the history
…'Layout
  • Loading branch information
Gayane Chilingaryan committed Sep 6, 2023
1 parent bc7bb8a commit 57f9631
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions packages/ketcher-core/src/application/render/restruct/reatom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,24 +708,28 @@ function buildLabel(
let label: any = {};
label.text = getLabelText(atom.a);

if (label.text === '') label = 'R#'; // for structures that missed 'M RGP' tag in molfile
if (typeof label === 'object') {
if (!label.text) {
label.text = 'R#';
}

if (label.text === atom.a.label) {
const element = Elements.get(label.text);
if (options.atomColoring && element) {
atom.color = ElementColor[label.text] || '#000';
}

if (label.text === atom.a.label) {
const element = Elements.get(label.text);
if (options.atomColoring && element) {
atom.color = ElementColor[label.text] || '#000';
const { previewOpacity } = options;
label.path = paper.text(ps.x, ps.y, label.text).attr({
font: options.font,
'font-size': options.fontsz,
fill: atom.color,
'font-style': atom.a.pseudo ? 'italic' : '',
'fill-opacity': atom.a.isPreview ? previewOpacity : 1,
});
}
}

const { previewOpacity } = options;
label.path = paper.text(ps.x, ps.y, label.text).attr({
font: options.font,
'font-size': options.fontsz,
fill: atom.color,
'font-style': atom.a.pseudo ? 'italic' : '',
'fill-opacity': atom.a.isPreview ? previewOpacity : 1,
});

label.rbb = util.relBox(label.path.getBBox());
draw.recenterText(label.path, label.rbb);

Expand Down

0 comments on commit 57f9631

Please sign in to comment.