diff --git a/cypress/platform/gitgraph.html b/cypress/platform/gitgraph.html index da81427f8..d8d16f6c9 100644 --- a/cypress/platform/gitgraph.html +++ b/cypress/platform/gitgraph.html @@ -30,7 +30,31 @@
+ %%{init: { "logLevel": "debug", "theme": "default" , "gitGraph" : {"showBranches":"false","rotateCommitLabel":"true"},"themeVariables": {
+ "gitBranchLabel0": "#ff0000",
+ "gitBranchLabel1": "#00ff00",
+ "gitBranchLabel2": "#0000ff",
+ "git0": "#550055"
+ } } }%%
+ gitGraph
+ commit
+ branch develop
+ commit
+ commit
+ branch release/1.0.0
+ checkout release/1.0.0
+ commit tag:"1.0.0-beta1"
+ checkout develop
+ commit
+ commit
+ commit
+ commit
+ checkout release/1.0.0
+ merge develop tag: "1.0.0-beta2"
+
+
%%{init: { "logLevel": "debug", "theme": "default" , "gitGraph" : {"showBranches":"false"},"themeVariables": {
"gitBranchLabel0": "#ff0000",
"gitBranchLabel1": "#00ff00",
@@ -131,6 +155,7 @@
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 1,
+ gitGraph: {rotateCommitLabel: false},
flowchart: { curve: 'linear', htmlLabels: true },
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorMargin: 50, showSequenceNumbers: true },
diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js
index 68905c0d2..2eb723762 100644
--- a/src/diagrams/git/gitGraphRenderer.js
+++ b/src/diagrams/git/gitGraphRenderer.js
@@ -1,7 +1,6 @@
import { select } from 'd3';
-import { configureSvgSize } from '../../setupGraphViewbox';
+import { getConfig,setupGraphViewbox } from '../../diagram-api/diagramAPI';
import { log } from '../../logger';
-import { getConfig } from '../../config';
import addSVGAccessibilityFields from '../../accessibility';
let allCommitsDict = {};
@@ -523,18 +522,8 @@ export const draw = function (txt, id, ver, diagObj) {
drawArrows(diagram, allCommitsDict);
drawCommits(diagram, allCommitsDict, true);
- const padding = gitGraphConfig.diagramPadding;
- const svgBounds = diagram.node().getBBox();
- const width = svgBounds.width + padding * 2;
- const height = svgBounds.height + padding * 2;
-
- configureSvgSize(diagram, height, width, conf.useMaxWidth);
- const vBox = `${
- svgBounds.x -
- padding -
- (gitGraphConfig.showBranches && gitGraphConfig.rotateCommitLabel === true ? 30 : 0)
- } ${svgBounds.y - padding} ${width} ${height}`;
- diagram.attr('viewBox', vBox);
+ // Setup the view box and size of the svg element
+ setupGraphViewbox(undefined, diagram, gitGraphConfig.diagramPadding, conf.useMaxWidth);
};
export default {