Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #150 from yodalee/issue140-vertical-arrow-with-mul…
Browse files Browse the repository at this point in the history
…tiple-branch-commit

fix issue 140 wrong arrow angle

Close #140
  • Loading branch information
nicoespeon authored Apr 3, 2017
2 parents 9585f1b + f3e8a4a commit 35f67de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
15 changes: 13 additions & 2 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var myTemplate = new GitGraph.Template(myTemplateConfig);
***********************/

var config = {
template: "metro", // could be: "blackarrow" or "metro" or `myTemplate` (custom Template object)
template: "blackarrow", // could be: "blackarrow" or "metro" or `myTemplate` (custom Template object)
reverseArrow: false, // to make arrows point to ancestors, if displayed
orientation: "vertical",
// mode: "compact" // special compact mode: hide messages & compact graph
Expand All @@ -53,7 +53,7 @@ gitGraph.commit("Initial commit");
gitGraph.commit("My second commit").commit("Add awesome feature");

// Create a new "dev" branch from "master" with some custom configuration
var dev = gitGraph.branch({
var dev = master.branch({
name: "dev",
color: "#F00",
commitDefaultOptions: {
Expand All @@ -78,6 +78,10 @@ var commitConfig = {
};
gitGraph.commit(commitConfig);

// Create another from "master"
var feature3 = master.branch("feature3")
feature3.commit().commit();

/***********************
* CHECKOUT *
***********************/
Expand Down Expand Up @@ -167,6 +171,13 @@ test.merge(master, {
tag: "v1.0.0"
});

// Create different branches from an empty one and do some commits
var features = master.branch("features")
var feature1 = features.branch("feature1")
var feature2 = features.branch("feature2")
feature1.commit();
feature2.commit().commit();

/***********************
* EVENTS *
***********************/
Expand Down
20 changes: 7 additions & 13 deletions src/gitgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,19 +768,13 @@

if (!isFirstBranch && isPathBeginning) {
this.pushPath(this.startPoint);

// Trace path from parent branch if it has commits already
if (this.parentBranch.commits.length > 0) {
this.pushPath({
x: this.startPoint.x - this.parentBranch.offsetX + this.offsetX - this.template.commit.spacingX,
y: this.startPoint.y - this.parentBranch.offsetY + this.offsetY - this.template.commit.spacingY,
type: "join"
});

var parent = _clone(this.startPoint);
parent.type = "join";
this.parentBranch.pushPath(parent);
}
// Add a path point to startpoint + offset - template spacing
// So that line will not go through commit of other branches
this.pushPath({
x: this.startPoint.x + this.offsetX - this.template.commit.spacingX,
y: this.startPoint.y + this.offsetY - this.template.commit.spacingY,
type: "join"
});
} else if (isPathBeginning) {
point.type = "start";
}
Expand Down

0 comments on commit 35f67de

Please sign in to comment.