mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 11:14:12 +01: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
|
* and commitB's x-position
|
||||||
*/
|
*/
|
||||||
const hasOverlappingCommits = (commitA, commitB, allCommits) =>
|
const hasOverlappingCommits = (commitA, commitB, allCommits) =>
|
||||||
Object.values(allCommits).some(
|
Object.values(allCommits).some((commitX) => {
|
||||||
(commitX) =>
|
const isOnSourceBranch = (x) => x.branch === commitA.branch;
|
||||||
(commitX.branch === commitA.branch || commitX.branch === commitB.branch) &&
|
const isOnTargetBranch = (x) => x.branch === commitB.branch;
|
||||||
commitX.seq > commitA.seq &&
|
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||||
commitX.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
|
* 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