From b984f49bda390d8bd81c7d6b9f3a0bc26c8b9584 Mon Sep 17 00:00:00 2001 From: Guzman Date: Wed, 14 Feb 2024 11:37:11 -0300 Subject: [PATCH] Only scrolling if selection was done programatically --- src/SeqViewerContainer.tsx | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/SeqViewerContainer.tsx b/src/SeqViewerContainer.tsx index c2f902810..8a85e2c66 100644 --- a/src/SeqViewerContainer.tsx +++ b/src/SeqViewerContainer.tsx @@ -46,11 +46,7 @@ interface SeqViewerContainerProps { rotateOnScroll: boolean; search: NameRange[]; selectAllEvent: (event: React.KeyboardEvent) => boolean; - selection?: { - clockwise?: boolean; - end: number; - start: number; - }; + selection?: Selection; seq: string; seqType: SeqType; showComplement: boolean; @@ -91,13 +87,16 @@ class SeqViewerContainer extends React.Component { - if ( - this.props.selection?.start !== prevProps.selection?.start && - this.props.selection?.start !== this.props.selection?.end - ) { - this.setCentralIndex("LINEAR", this.props.selection?.start || 0); + // Only scroll if the selection was done programatically, i.e.: has no type. + if (!this.props.selection?.type) { + if ( + this.props.selection?.start !== prevProps.selection?.start && + this.props.selection?.start !== this.props.selection?.end + ) { + this.setCentralIndex("LINEAR", this.props.selection?.start || 0); + } } }; @@ -135,11 +134,7 @@ class SeqViewerContainer extends React.Component { if (prop) { return { ...prop, clockwise: typeof prop.clockwise === "undefined" || !!prop.clockwise, type: "" };