Refactoring edge labels' code
This commit is contained in:
parent
bbfcf99b72
commit
cd89680700
18
springyui.js
18
springyui.js
|
@ -220,13 +220,17 @@ jQuery.fn.springy = function(params) {
|
|||
}
|
||||
|
||||
// label
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "top";
|
||||
ctx.font = "10px Helvetica, sans-serif";
|
||||
ctx.fillStyle = "#5BA6EC";
|
||||
var text = typeof(edge.data.label) !== 'undefined' ? edge.data.label : '';
|
||||
ctx.fillText(text, (x1+x2)/2, (y1+y2)/2);
|
||||
ctx.restore();
|
||||
|
||||
if (text = typeof(edge.data.label) !== 'undefined') {
|
||||
ctx.save();
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "top";
|
||||
ctx.font = "10px Helvetica, sans-serif";
|
||||
ctx.fillStyle = "#5BA6EC";
|
||||
ctx.fillText(text, (x1+x2)/2, (y1+y2)/2);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
},
|
||||
function drawNode(node, p) {
|
||||
var s = toScreen(p);
|
||||
|
|
Loading…
Reference in New Issue
Block a user