nice, node highlighting now

This commit is contained in:
Peter Cottle 2012-10-13 13:14:45 -07:00
parent 1d59152931
commit 8534bdad2c
4 changed files with 57 additions and 19 deletions

View file

@ -488,7 +488,7 @@ var VisNode = Backbone.Model.extend({
r: this.getRadius(),
fill: this.getFill(),
'stroke-width': this.get('stroke-width'),
'stroke': this.get('stroke')
stroke: this.get('stroke')
},
text: {
x: textPos.x,
@ -498,6 +498,22 @@ var VisNode = Backbone.Model.extend({
};
},
highlightTo: function(branch, speed, easing) {
// a small function to highlight the color of a node for demonstration purposes
var color = branch.get('fill');
var attr = {
circle: {
fill: color,
stroke: color,
'stroke-width': this.get('stroke-width') * 5
},
text: {}
};
this.animateToAttr(attr, speed, easing);
},
animateUpdatedPosition: function(speed, easing) {
var attr = this.getAttributes();
this.animateToAttr(attr, speed, easing);