diff --git a/packages/ketcher-core/src/chemistry/entities/SGroup.ts b/packages/ketcher-core/src/chemistry/entities/SGroup.ts index 3c28ac5d41..e0e477a655 100644 --- a/packages/ketcher-core/src/chemistry/entities/SGroup.ts +++ b/packages/ketcher-core/src/chemistry/entities/SGroup.ts @@ -245,14 +245,16 @@ export class SGroup { static getBracketParameters( mol, - xbonds, + crossBonds, atomSet: Pile, bb, d, n ): Array { var brackets: Array = [] - if (xbonds.length < 2) { + const crossBondsPerAtom = Object.values(crossBonds) + const crossBondsValues = Array.prototype.concat.apply([], crossBondsPerAtom) + if (crossBondsValues.length < 2) { ;(function () { d = d || new Vec2(1, 0) n = n || d.rotateSC(1, 0) @@ -266,11 +268,11 @@ export class SGroup { new SGroupBracketParams(cr, d, bracketWidth, bracketHeight) ) })() - } else if (xbonds.length === 2) { + } else if (crossBondsValues.length === 2) { ;(function () { // eslint-disable-line max-statements - var b1 = mol.bonds.get(xbonds[0]) - var b2 = mol.bonds.get(xbonds[1]) + var b1 = mol.bonds.get(crossBondsValues[0]) + var b2 = mol.bonds.get(crossBondsValues[1]) var cl0 = b1.getCenter(mol) var cr0 = b2.getCenter(mol) var dr = Vec2.diff(cr0, cl0).normalized() @@ -295,8 +297,8 @@ export class SGroup { })() } else { ;(function () { - for (var i = 0; i < xbonds.length; ++i) { - var b = mol.bonds.get(xbonds[i]) + for (var i = 0; i < crossBondsValues.length; ++i) { + var b = mol.bonds.get(crossBondsValues[i]) var c = b.getCenter(mol) var d = atomSet.has(b.begin) ? b.getDir(mol) : b.getDir(mol).negated() brackets.push(new SGroupBracketParams(c, d, 0.2, 1.0))