Skip to content

Commit

Permalink
Allowing crossing zero cut sites in circular view
Browse files Browse the repository at this point in the history
  • Loading branch information
guzmanvig committed Sep 25, 2024
1 parent 52995ed commit 37f2557
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Circular/CutSites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37f2557

Please sign in to comment.