Skip to content

Commit

Permalink
#2428 - Atom letter is drawn at the cursor after user selects structu…
Browse files Browse the repository at this point in the history
…re/part of structure on the canvas and then click atom on the toolbar (#2601)

* Do not show hoverIcon if there's active selection
  • Loading branch information
gairon committed May 15, 2023
1 parent 70ec4d2 commit 829a44b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/ketcher-react/src/script/editor/tool/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ class AtomTool {
this.atomProps = atomProps
this.#bondProps = { type: 1, stereo: Bond.PATTERN.STEREO.NONE }

this.editor.hoverIcon.show()
this.editor.hoverIcon.label = atomProps.label
this.editor.hoverIcon.fill = ElementColor[atomProps.label] ?? '#000000'
this.editor.hoverIcon.updatePosition()
const editorSelection = editor.selection()

if (editor.selection()) {
if (editor.selection()?.atoms) {
if (editorSelection) {
if (editorSelection.atoms) {
const action = fromAtomsAttrs(
editor.render.ctab,
editor.selection().atoms,
editorSelection.atoms,
atomProps,
true
)
Expand All @@ -61,6 +58,11 @@ class AtomTool {
}

this.isNotActiveTool = true
} else {
this.editor.hoverIcon.show()
this.editor.hoverIcon.label = atomProps.label
this.editor.hoverIcon.fill = ElementColor[atomProps.label] ?? '#000000'
this.editor.hoverIcon.updatePosition()
}
}

Expand Down

0 comments on commit 829a44b

Please sign in to comment.