Skip to content

Commit

Permalink
#3553 - macro while pulling bond onto monomer a preview is shown when…
Browse files Browse the repository at this point in the history
… hover monomer (#3600)

* Conditional rendering of the monomer preview
  • Loading branch information
ivan-arkhipov-epam authored Nov 27, 2023
1 parent b6ff7dc commit fd2a633
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ketcher-polymer-editor-react/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ interface EditorProps {
togglerComponent?: JSX.Element;
}

const noPreviewTools = ['bond-single'];

function EditorContainer({
onInit,
theme,
Expand Down Expand Up @@ -208,7 +210,10 @@ function Editor({ theme, togglerComponent }: EditorProps) {
});
editor?.events.mouseOnMoveMonomer.add((e) => {
handleClosePreview();
handleOpenPreview(e);
const isLeftClick = e.buttons === 1;
if (!isLeftClick || !noPreviewTools.includes(activeTool)) {
handleOpenPreview(e);
}
});
}, [editor, activeTool]);

Expand Down

0 comments on commit fd2a633

Please sign in to comment.