Skip to content

Commit

Permalink
#4394 - In the Sequence mode, the tooltip “Start new sequence” is sho…
Browse files Browse the repository at this point in the history
…wn outside of the canvas (#5708)
  • Loading branch information
rrodionov91 authored and Guch1g0v committed Oct 17, 2024
1 parent 47f1f87 commit 580f1f9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/ketcher-core/src/application/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ export class CoreEditor {
event.preventDefault();

const eventData = event.target?.__data__;
const canvasBoundingClientRect = this.canvas.getBoundingClientRect();
const isClickOnCanvas =
event.clientX >= canvasBoundingClientRect.left &&
event.clientX <= canvasBoundingClientRect.right &&
event.clientY >= canvasBoundingClientRect.top &&
event.clientY <= canvasBoundingClientRect.bottom;

if (eventData instanceof BaseSequenceItemRenderer) {
this.events.rightClickSequence.dispatch(
Expand All @@ -217,7 +223,7 @@ export class CoreEditor {
eventData instanceof SnakeModePolymerBondRenderer
) {
this.events.rightClickPolymerBond.dispatch(event, eventData);
} else {
} else if (isClickOnCanvas) {
this.events.rightClickCanvas.dispatch(event);
}

Expand Down

0 comments on commit 580f1f9

Please sign in to comment.