Still working on the connecting lines

This commit is contained in:
Jeff Avallone 2014-12-09 21:32:13 -05:00
parent 629faf7086
commit 4a8103f404
1 changed files with 14 additions and 5 deletions

View File

@ -40,9 +40,15 @@ export default _.extend({}, Base, {
pathStr; pathStr;
if (distance >= 15) { if (distance >= 15) {
pathStr = 'M10,{box.cy}m0,{shift}q0,{curve} 10,{curve}h{box.x}'; pathStr = [
'M10,{box.cy}m0,{shift}q0,{curve} 10,{curve}h{box.x}',
'M{containerBox.width},{box.cy}m30,{shift}q0,{curve} -10,{curve}h-{box.x}'
].join('');
} else { } else {
pathStr = 'M0,{containerBox.cy}c10,0 10,{anchor.y} {anchor.x},{anchor.y}'; pathStr = [
'M0,{containerBox.cy}c10,0 10,{anchor.y} {anchor.x},{anchor.y}',
'M{containerBox.width},{containerBox.cy}m40,0c-10,0 -10,{anchor.y} -{anchor.x},{anchor.y}'
].join('');
} }
return Snap.format(pathStr, { return Snap.format(pathStr, {
@ -57,15 +63,18 @@ export default _.extend({}, Base, {
}); });
}); });
paths.push(Snap.format('M0,{box.cy}q10,0 10,-10V{top}M0,{box.cy}q10,0 10,10V{bottom}', { paths.push(Snap.format([
'M0,{box.cy}q10,0 10,-10V{top}',
'M0,{box.cy}q10,0 10,10V{bottom}',
'M{box.width},{box.cy}m40,0q-10,0 -10,-10V{top}',
'M{box.width},{box.cy}m40,0q-10,0 -10,10V{bottom}'
].join(''), {
box: containerBox, box: containerBox,
top: _.first(matches).getBBox().cy + 10, top: _.first(matches).getBBox().cy + 10,
bottom: _.last(matches).getBBox().cy - 10 bottom: _.last(matches).getBBox().cy - 10
})); }));
this.container.prepend(this.container.path(paths.join(''))); this.container.prepend(this.container.path(paths.join('')));
this.container.prepend(this.container.path(paths.join(''))
.transform(Snap.matrix().scale(-1, 1, containerBox.cx - 10, 0)));
} }
}, },