mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 06:20:07 +02:00
GitGraph: Rewrote overlap fn to make main branch exception to rule.
This commit is contained in:
@@ -352,12 +352,16 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
||||
* and commitB's x-position
|
||||
*/
|
||||
const hasOverlappingCommits = (commitA, commitB, allCommits) =>
|
||||
Object.values(allCommits).some(
|
||||
(commitX) =>
|
||||
(commitX.branch === commitA.branch || commitX.branch === commitB.branch) &&
|
||||
commitX.seq > commitA.seq &&
|
||||
commitX.seq < commitB.seq
|
||||
);
|
||||
Object.values(allCommits).some((commitX) => {
|
||||
const isOnSourceBranch = (x) => x.branch === commitA.branch;
|
||||
const isOnTargetBranch = (x) => x.branch === commitB.branch;
|
||||
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||
const isTargetMain = (x) => x.branch === getConfig().gitGraph.mainBranchName;
|
||||
return (
|
||||
(isOnSourceBranch(commitX) || (isOnTargetBranch(commitX) && !isTargetMain(commitX))) &&
|
||||
isBetweenCommits(commitX)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* This function find a lane in the y-axis that is not overlapping with any other lanes. This is
|
||||
|
Reference in New Issue
Block a user