Skip to content

Commit

Permalink
#4941 - System shows Edit S-Group option for every bond of molecule i…
Browse files Browse the repository at this point in the history
…f it has attachment point
  • Loading branch information
Guch1g0v committed Jul 2, 2024
1 parent e42b47d commit 23a6f28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const useBondSGroupAttach = () => {

const bond = struct.bonds.get(bondIds[0])!;
const attachedSGroups = bond.b.getAttachedSGroups(struct.molecule);

const [sgGroupId] = attachedSGroups;
const sgroup = struct.sgroups.get(sgGroupId)?.item;
if (sgroup?.isSuperatomWithoutLabel) {
return false;
}
return attachedSGroups.size > 0;
},
[getKetcherInstance],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ const useBondSGroupEdit = () => {
);

const hidden = useCallback(() => {
const editor = getKetcherInstance().editor as Editor;
const struct: ReStruct = editor.render.ctab;
const [sgGroupId] = sGroupsRef.current;
const sgroup = struct.sgroups.get(sgGroupId)?.item;
if (sgroup?.isSuperatomWithoutLabel) {
return true;
}
return sGroupsRef.current.size === 0;
}, []);
}, [getKetcherInstance]);

return [handler, disabled, hidden] as const;
};
Expand Down

0 comments on commit 23a6f28

Please sign in to comment.