/**
*
* @param firstCommit
* @param secondCommit
* @param switchLanesEarly (boolean): Move the line to the secondCommit's lane ASAP? Defaults to false
*/
function connectDots( firstCommit, secondCommit, switchLanesEarly ) {
// default value for switchLanesEarly
switchLanesEarly = switchLanesEarly || false;
var lineLane = switchLanesEarly ? secondCommit.lane : firstCommit.lane;
// the connection has 4 stops, resulting in the following 3 segments:
// - from the x/y center of firstCommit.dot to the rightmost end (x) of the commit's column, with y=lineLane
// - from the rightmost end of firstCommit's column, to the leftmost end of secondCommit's column
// - from the leftmost end of secondCommit's column (y=lineLane) to the x/y center of secondCommit
paper.path(
getSvgLineString(
[firstCommit.dot.attr('cx'), firstCommit.dot.attr('cy')],
[firstCommit.dot.attr('cx') + (cfg.columnWidth/2), lineLane.centerY],
[secondCommit.dot.attr('cx') - (cfg.columnWidth/2), lineLane.centerY],
[secondCommit.dot.attr('cx'), secondCommit.dot.attr('cy')]
)
).attr({ "stroke": lineLane.color, "stroke-width": 2 }).toBack();