[Origin] Makes two visualizations now and links the objects and small graphical updates

This commit is contained in:
Peter Cottle 2013-05-26 16:34:54 -07:00
parent 5e151238c9
commit 91f0e13132
5 changed files with 180 additions and 99 deletions

View file

@ -109,6 +109,8 @@ var VisNode = VisBase.extend({
var pos = this.getScreenCoords();
var textPos = this.getTextScreenCoords();
var opacity = this.getOpacity();
var dashArray = (this.getIsInOrigin()) ?
GRAPHICS.originDash : '';
return {
circle: {
@ -118,6 +120,7 @@ var VisNode = VisBase.extend({
r: this.getRadius(),
fill: this.getFill(),
'stroke-width': this.get('stroke-width'),
'stroke-dasharray': dashArray,
stroke: this.get('stroke')
},
text: {
@ -162,19 +165,16 @@ var VisNode = VisBase.extend({
this.animateToAttr(snapShot[this.getID()], speed, easing);
},
animateToAttr: function(attr, speed, easing) {
if (speed === 0) {
this.get('circle').attr(attr.circle);
this.get('text').attr(attr.text);
return;
}
setAttr: function(attr, instant, speed, easing) {
var keys = ['text', 'circle'];
this.setAttrBase(keys, attr, instant, speed, easing);
},
animateToAttr: function(attr, speed, easing) {
VisBase.prototype.animateToAttr.apply(this, arguments);
var s = speed !== undefined ? speed : this.get('animationSpeed');
var e = easing || this.get('animationEasing');
this.get('circle').stop().animate(attr.circle, s, e);
this.get('text').stop().animate(attr.text, s, e);
if (easing == 'bounce' &&
attr.circle && attr.circle.cx !== undefined &&
attr.text && attr.text.x !== undefined ) {