Skip to content

Commit

Permalink
#4782 - It is possible to attach bond to attachment point label
Browse files Browse the repository at this point in the history
  • Loading branch information
Guch1g0v committed Jun 13, 2024
1 parent e44c1a9 commit 9d0d566
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/ketcher-react/src/script/editor/tool/bond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
fromOneBondDeletion,
Struct,
vectorUtils,
Atom,
} from 'ketcher-core';

import Editor from '../Editor';
Expand Down Expand Up @@ -333,12 +334,18 @@ class BondTool implements Tool {
this.editor.update(bondAddition[0]);
} else if (dragCtx.item.map === 'atoms') {
// click on atom
this.editor.update(
fromBondAddition(render.ctab, this.bondProps, dragCtx.item.id, {
label: 'C',
})[0],
const isAtomSuperatomLeavingGroup = Atom.isSuperatomLeavingGroupAtom(
struct,
dragCtx.item.id,
);
delete this.dragCtx.existedBond;
if (!isAtomSuperatomLeavingGroup) {
this.editor.update(
fromBondAddition(render.ctab, this.bondProps, dragCtx.item.id, {
label: 'C',
})[0],
);
delete this.dragCtx.existedBond;
}
} else if (dragCtx.item.map === 'bonds') {
const bondProps = Object.assign({}, this.bondProps);
const bond = struct.bonds.get(dragCtx.item.id) as Bond;
Expand Down

0 comments on commit 9d0d566

Please sign in to comment.