Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4782 - It is possible to attach bond to attachment point label #4835

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading