From 37f25572b666dfd7ef8e439db583de4f9be624b3 Mon Sep 17 00:00:00 2001 From: Guzman Date: Wed, 25 Sep 2024 12:05:40 -0300 Subject: [PATCH] Allowing crossing zero cut sites in circular view --- src/Circular/CutSites.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Circular/CutSites.tsx b/src/Circular/CutSites.tsx index 98247916a..e9271971c 100644 --- a/src/Circular/CutSites.tsx +++ b/src/Circular/CutSites.tsx @@ -20,11 +20,9 @@ interface CutSitesProps { } export const CutSites = (props: CutSitesProps) => { - let { cutSites } = props; + const { cutSites } = props; if (!cutSites.length) return null; - cutSites = cutSites.filter(c => c.end > c.start); - const calculateLinePath = (index: number, startRadius: number, endRadius: number): string => { const { findCoor } = props; const lineStart = findCoor(index, startRadius); @@ -55,14 +53,18 @@ const SingleCutSite = (props: { const { id, start } = cutSite; let { end, fcut, rcut } = cutSite; - // crosses the zero index - if (start + fcut > end + rcut) { - end = start > end ? end + seqLength : end; - if (fcut > rcut) { - rcut += seqLength; - } else { + // If any of the end or cut values are greater than the start, it's corssing the zero index + if (start > end || start > fcut || start > rcut) { + // So add the length of the sequence to all values that are crossing the zero index + if (start > end) { + end += seqLength; + } + if (start > fcut) { fcut += seqLength; } + if (start > rcut) { + rcut += seqLength; + } } // length for highlighted recog area