Tidied up comments from code review
This commit is contained in:
parent
fd1cd6ba49
commit
b373d7ead6
11
springyui.js
11
springyui.js
|
@ -84,8 +84,6 @@ jQuery.fn.springy = function(params) {
|
||||||
selected = nearest = dragged = layout.nearest(p);
|
selected = nearest = dragged = layout.nearest(p);
|
||||||
|
|
||||||
if (selected.node !== null) {
|
if (selected.node !== null) {
|
||||||
// Part of the same bug mentioned later. Store the previous mass
|
|
||||||
// before upscaling it for dragging.
|
|
||||||
dragged.point.m = 10000.0;
|
dragged.point.m = 10000.0;
|
||||||
|
|
||||||
if (nodeSelected) {
|
if (nodeSelected) {
|
||||||
|
@ -110,9 +108,6 @@ jQuery.fn.springy = function(params) {
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(window).bind('mouseup',function(e) {
|
jQuery(window).bind('mouseup',function(e) {
|
||||||
// Bug! Node's mass isn't reset on mouseup. Nodes which have been
|
|
||||||
// dragged don't repulse very well. Store the initial mass in mousedown
|
|
||||||
// and then restore it here.
|
|
||||||
dragged = null;
|
dragged = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -133,7 +128,6 @@ jQuery.fn.springy = function(params) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Node.prototype.getHeight = function() {
|
Node.prototype.getHeight = function() {
|
||||||
// Magic number with no explanation.
|
|
||||||
return 20;
|
return 20;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -208,7 +202,6 @@ jQuery.fn.springy = function(params) {
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
||||||
// arrow
|
// arrow
|
||||||
|
|
||||||
if (directional) {
|
if (directional) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.fillStyle = stroke;
|
ctx.fillStyle = stroke;
|
||||||
|
@ -225,7 +218,6 @@ jQuery.fn.springy = function(params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// label
|
// label
|
||||||
|
|
||||||
if (typeof(edge.data.label) !== 'undefined') {
|
if (typeof(edge.data.label) !== 'undefined') {
|
||||||
text = edge.data.label
|
text = edge.data.label
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
@ -246,7 +238,7 @@ jQuery.fn.springy = function(params) {
|
||||||
var boxWidth = node.getWidth();
|
var boxWidth = node.getWidth();
|
||||||
var boxHeight = node.getHeight();
|
var boxHeight = node.getHeight();
|
||||||
|
|
||||||
// fill background
|
// clear background
|
||||||
ctx.clearRect(s.x - boxWidth/2, s.y - 10, boxWidth, 20);
|
ctx.clearRect(s.x - boxWidth/2, s.y - 10, boxWidth, 20);
|
||||||
|
|
||||||
// fill background
|
// fill background
|
||||||
|
@ -257,7 +249,6 @@ jQuery.fn.springy = function(params) {
|
||||||
} else {
|
} else {
|
||||||
ctx.fillStyle = "#FFFFFF";
|
ctx.fillStyle = "#FFFFFF";
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.fillRect(s.x - boxWidth/2, s.y - 10, boxWidth, 20);
|
ctx.fillRect(s.x - boxWidth/2, s.y - 10, boxWidth, 20);
|
||||||
|
|
||||||
ctx.textAlign = "left";
|
ctx.textAlign = "left";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user