mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
have arrows now, rough
This commit is contained in:
parent
b566ebf6f6
commit
8d6e835538
1 changed files with 14 additions and 0 deletions
14
src/tree.js
14
src/tree.js
|
@ -104,6 +104,12 @@ var VisEdge = Backbone.Model.extend({
|
||||||
y: pos.y + delta * dir
|
y: pos.y + delta * dir
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
var offset2d = function(pos, x, y) {
|
||||||
|
return {
|
||||||
|
x: pos.x + x,
|
||||||
|
y: pos.y + y
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// first offset tail and head by radii
|
// first offset tail and head by radii
|
||||||
tailPos = offset(tailPos, -1, tail.getRadius());
|
tailPos = offset(tailPos, -1, tail.getRadius());
|
||||||
|
@ -119,6 +125,14 @@ var VisEdge = Backbone.Model.extend({
|
||||||
str += coords(offset(headPos, 1)) + ' ';
|
str += coords(offset(headPos, 1)) + ' ';
|
||||||
// now finish
|
// now finish
|
||||||
str += coords(headPos);
|
str += coords(headPos);
|
||||||
|
|
||||||
|
// arrow head
|
||||||
|
// TODO default sizing
|
||||||
|
var delta = GRAPHICS.arrowHeadSize || 10;
|
||||||
|
str += ' L' + coords(offset2d(headPos, -delta, delta));
|
||||||
|
str += ' L' + coords(offset2d(headPos, delta, delta));
|
||||||
|
str += ' L' + coords(headPos);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue