diff --git a/packages/ketcher-core/src/domain/entities/multitailArrow.ts b/packages/ketcher-core/src/domain/entities/multitailArrow.ts index b9d9f0c310..ce02a4dcab 100644 --- a/packages/ketcher-core/src/domain/entities/multitailArrow.ts +++ b/packages/ketcher-core/src/domain/entities/multitailArrow.ts @@ -276,10 +276,10 @@ export class MultitailArrow extends BaseMicromoleculeEntity { if (typeof second === 'number') { const originalValue = this.tailsYOffset.get(second) as number; let updatedHeight = Math.max( - MultitailArrow.MIN_TOP_BOTTOM_OFFSET, + MultitailArrow.MIN_TAIL_DISTANCE, Math.min( originalValue + offset, - this.height - MultitailArrow.MIN_TOP_BOTTOM_OFFSET, + this.height - MultitailArrow.MIN_TAIL_DISTANCE, ), ); if (normalize) { diff --git a/packages/ketcher-react/src/script/editor/tool/arrow/commonArrow.ts b/packages/ketcher-react/src/script/editor/tool/arrow/commonArrow.ts index 16c5a5f006..3f0a1c5c5c 100644 --- a/packages/ketcher-react/src/script/editor/tool/arrow/commonArrow.ts +++ b/packages/ketcher-react/src/script/editor/tool/arrow/commonArrow.ts @@ -29,6 +29,14 @@ export class CommonArrowTool extends ArrowTool implements Tool { return dragContext.closestItem.map === MULTITAIL_ARROW_KEY; } + static isDragContextReaction( + dragContext: CommonArrowDragContext< + MultitailArrowClosestItem | ReactionArrowClosestItem + >, + ): dragContext is CommonArrowDragContext { + return dragContext.closestItem.map === 'rxnArrows'; + } + private dragContext: | CommonArrowDragContext< MultitailArrowClosestItem | ReactionArrowClosestItem @@ -101,13 +109,15 @@ export class CommonArrowTool extends ArrowTool implements Tool { event, this.dragContext, ); - } else { - // Otherwise build fails during prod build but not dev - const dragContext = this - .dragContext as CommonArrowDragContext; - dragContext.action = this.reactionMoveTool.mousemove(event, dragContext); + } else if (CommonArrowTool.isDragContextReaction(this.dragContext)) { + this.dragContext.action = this.reactionMoveTool.mousemove( + event, + this.dragContext, + ); + } + if (this.dragContext.action) { + this.editor.update(this.dragContext.action, true); } - this.editor.update(this.dragContext.action, true); } mouseup(event: PointerEvent) { @@ -121,11 +131,11 @@ export class CommonArrowTool extends ArrowTool implements Tool { event, this.dragContext, ); - } else { - // Otherwise build fails during prod build but not dev - const dragContext = this - .dragContext as CommonArrowDragContext; - dragContext.action = this.reactionMoveTool.mouseup(event, dragContext); + } else if (CommonArrowTool.isDragContextReaction(this.dragContext)) { + this.dragContext.action = this.reactionMoveTool.mouseup( + event, + this.dragContext, + ); } const { action } = this.dragContext; if (action) {