From 580f1f97e90a0bb3c36ceb0bb0fe20a725bdd1eb Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Thu, 10 Oct 2024 13:32:32 +0200 Subject: [PATCH] =?UTF-8?q?#4394=20-=20In=20the=20Sequence=20mode,=20the?= =?UTF-8?q?=20tooltip=20=E2=80=9CStart=20new=20sequence=E2=80=9D=20is=20sh?= =?UTF-8?q?own=20outside=20of=20the=20canvas=20(#5708)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ketcher-core/src/application/editor/Editor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/ketcher-core/src/application/editor/Editor.ts b/packages/ketcher-core/src/application/editor/Editor.ts index ada294678d..627fbd8408 100644 --- a/packages/ketcher-core/src/application/editor/Editor.ts +++ b/packages/ketcher-core/src/application/editor/Editor.ts @@ -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( @@ -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); }