Skip to content

Commit

Permalink
#2060 - fix redundant actions on mouse events when not over canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Permiakov authored and Stanislav Permiakov committed Jan 10, 2023
1 parent 24e78e2 commit 838bf08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/ketcher-react/src/script/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ function isMouseRight(event) {
}

function resetSelectionOnCanvasClick(editor: Editor, eventName: string) {
if (eventName === 'mouseup') {
if (eventName === 'mouseup' && editor.selection()) {
editor.selection(null)
}
}
Expand Down Expand Up @@ -645,7 +645,11 @@ function domEventSetup(editor: Editor, clientArea) {
}
const EditorTool = editor.tool()
editor.lastEvent = event
if (EditorTool && eventName in EditorTool) {
if (
EditorTool &&
eventName in EditorTool &&
clientArea.contains(event.target)
) {
EditorTool[eventName](event)
return true
}
Expand Down

0 comments on commit 838bf08

Please sign in to comment.