GitGraph: simplified branch check in arrow rerouting fn

Wanted to avoid repetition given that the originally nested
ternaries had the same structure
This commit is contained in:
Guy Pursey
2023-10-27 11:42:57 +01:00
parent d80e1a2662
commit a9c5d903c5

View File

@@ -359,14 +359,9 @@ const drawCommits = (svg, commits, modifyGraph) => {
* return true
*/
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
const branchToGetCurve =
dir === 'TB'
? p1.x < p2.x
? commitB.branch
: commitA.branch
: p1.y < p2.y
? commitB.branch
: commitA.branch;
const branchToGetCurve = (dir === 'TB' ? p1.x < p2.x : p1.y < p2.y)
? commitB.branch
: commitA.branch;
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
return Object.values(allCommits).some((commitX) => {