mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 19:24:10 +01:00
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:
@@ -359,14 +359,9 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
|||||||
* return true
|
* return true
|
||||||
*/
|
*/
|
||||||
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
||||||
const branchToGetCurve =
|
const branchToGetCurve = (dir === 'TB' ? p1.x < p2.x : p1.y < p2.y)
|
||||||
dir === 'TB'
|
? commitB.branch
|
||||||
? p1.x < p2.x
|
: commitA.branch;
|
||||||
? commitB.branch
|
|
||||||
: commitA.branch
|
|
||||||
: p1.y < p2.y
|
|
||||||
? commitB.branch
|
|
||||||
: commitA.branch;
|
|
||||||
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
|
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
|
||||||
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||||
return Object.values(allCommits).some((commitX) => {
|
return Object.values(allCommits).some((commitX) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user