From d21a500ea894b8e0c0429f19e10c10a8b4eaaec3 Mon Sep 17 00:00:00 2001 From: Michael Bostock Date: Tue, 9 Nov 2010 14:42:31 -0800 Subject: [PATCH] Fix bug in style tween. --- d3.js | 4 ++-- d3.min.js | 16 ++++++++-------- src/core/core.js | 2 +- src/core/transition.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/d3.js b/d3.js index 0348958a..ee0ac7b3 100644 --- a/d3.js +++ b/d3.js @@ -1,4 +1,4 @@ -d3 = {version: "0.15.2"}; // semver +d3 = {version: "0.15.3"}; // semver if (!Date.now) Date.now = function() { return +new Date(); }; @@ -1295,7 +1295,7 @@ function d3_transition(groups) { function styleTween(d, i) { var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); return function(t) { - this.style.setProperty(name, i(t), priority); + this.style.setProperty(name, f(t), priority); }; } diff --git a/d3.min.js b/d3.min.js index 43072364..aa9acd05 100644 --- a/d3.min.js +++ b/d3.min.js @@ -1,4 +1,4 @@ -(function(){var p=null;d3={version:"0.15.2"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function d(){}d.prototype=a;return new d};function t(a){return Array.prototype.slice.call(a)}function B(a,d){d=t(arguments);d[0]=this;a.apply(this,d);return this}d3.range=function(a,d,e){if(arguments.length==1){d=a;a=0}if(e==p)e=1;if((d-a)/e==Infinity)throw Error("infinite range");var f=[],c=-1,b;if(e<0)for(;(b=a+e*++c)>d;)f.push(b);else for(;(b=a+e*++c)d;)f.push(b);else for(;(b=a+e*++c)d?1:0}d3.transition=U.transition; function V(a){function d(k){var l=true,n=-1;a.each(function(){if(h[++n]!=2){var q=(k-g[n])/i[n],r,m=c[n];if(q<1){l=false;if(!(q<0)){if(h[n]){if(this.g!=e){h[n]=2;return}}else{h[n]=1;b.start.dispatch.apply(this,arguments);m=c[n]={};this.g=e;for(r in f)m[r]=f[r].apply(this,arguments)}q=o(q);for(r in f)m[r].call(this,q)}}else{h[n]=2;if(this.g==e){for(r in f)m[r].call(this,1);delete this.g;b.end.dispatch.apply(this,arguments)}}}});return l}var e={},f={},c=[],b=d3.dispatch("start","end"),h=[],g=[],i=[], -j,o=d3.ease("cubic-in-out");e.delay=function(k){var l=Infinity,n=-1;if(typeof k=="function")a.each(function(){var q=g[++n]=+k.apply(this,arguments);if(qj)j=n})}else{j=+k;a.each(function(){i[++l]=j})}return e};e.ease=function(k){o=typeof k=="string"?d3.ease(k):k;return e};e.attrTween=function(k,l){function n(r,m){var x= -l.call(this,r,m,this.getAttribute(k));return function(y){this.setAttribute(k,x(y))}}function q(r,m){var x=l.call(this,r,m,this.getAttributeNS(k.space,k.local));return function(y){this.setAttributeNS(k.space,k.local,x(y))}}f["attr."+k]=k.local?q:n;return e};e.attr=function(k,l){return e.attrTween(k,W(l))};e.styleTween=function(k,l,n){f["style."+k]=function(q,r){l.call(this,q,r,window.getComputedStyle(this,p).getPropertyValue(k));return function(m){this.style.setProperty(k,r(m),n)}};return e};e.style= -function(k,l,n){return e.styleTween(k,W(l),n)};e.select=function(k){var l;k=V(a.select(k)).ease(o);l=-1;k.delay(function(){return g[++l]});l=-1;k.duration(function(){return i[++l]});return k};e.selectAll=function(k){var l;k=V(a.selectAll(k)).ease(o);l=-1;k.delay(function(n,q){return g[q?l:++l]});l=-1;k.duration(function(n,q){return i[q?l:++l]});return k};e.each=function(k,l){b[k].add(l);return e};e.call=B;return e.delay(0).duration(250)}var X=p,Y=0,Z; +j,o=d3.ease("cubic-in-out");e.delay=function(k){var l=Infinity,n=-1;if(typeof k=="function")a.each(function(){var q=g[++n]=+k.apply(this,arguments);if(qj)j=n})}else{j=+k;a.each(function(){i[++l]=j})}return e};e.ease=function(k){o=typeof k=="string"?d3.ease(k):k;return e};e.attrTween=function(k,l){function n(r,m){var t= +l.call(this,r,m,this.getAttribute(k));return function(y){this.setAttribute(k,t(y))}}function q(r,m){var t=l.call(this,r,m,this.getAttributeNS(k.space,k.local));return function(y){this.setAttributeNS(k.space,k.local,t(y))}}f["attr."+k]=k.local?q:n;return e};e.attr=function(k,l){return e.attrTween(k,W(l))};e.styleTween=function(k,l,n){f["style."+k]=function(q,r){var m=l.call(this,q,r,window.getComputedStyle(this,p).getPropertyValue(k));return function(t){this.style.setProperty(k,m(t),n)}};return e}; +e.style=function(k,l,n){return e.styleTween(k,W(l),n)};e.select=function(k){var l;k=V(a.select(k)).ease(o);l=-1;k.delay(function(){return g[++l]});l=-1;k.duration(function(){return i[++l]});return k};e.selectAll=function(k){var l;k=V(a.selectAll(k)).ease(o);l=-1;k.delay(function(n,q){return g[q?l:++l]});l=-1;k.duration(function(n,q){return i[q?l:++l]});return k};e.each=function(k,l){b[k].add(l);return e};e.call=B;return e.delay(0).duration(250)}var X=p,Y=0,Z; function ma(a,d){var e=Date.now(),f=false,c=e+d,b=X;if(isFinite(d)){for(;b;){if(b.j==a){b.i=e;b.delay=d;f=true}else{var h=b.i+b.delay;if(he.delay)e.l=e.j(a);e=e.next}a=p;for(d=X;d;)d=d.l?a?a.next=d.next:X=d.next:(a=d).next;a||(Z=clearInterval(Z))} function W(a){return typeof a=="function"?function(d,e,f){return d3.interpolate(f,a.call(this,d,e))}:function(d,e,f){return d3.interpolate(f,a)}}d3.scale={}; d3.scale.linear=function(){function a(j){return i((j-e)*h)}function d(j){var o=Math.min(e,f),k=Math.max(e,f),l=k-o,n=Math.pow(10,Math.floor(Math.log(l/j)/Math.LN10));j=j/(l/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(k/n)*n+n*0.5,k:n}}var e=0,f=1,c=0,b=1,h=1/(f-e),g=(f-e)/(b-c),i=d3.interpolate(c,b);a.invert=function(j){return(j-c)*g+e};a.domain=function(j){if(!arguments.length)return[e,f];e=j[0];f=j[1];h=1/(f-e);g=(f-e)/(b-c);return a}; diff --git a/src/core/core.js b/src/core/core.js index 52f25290..f7c33213 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -1 +1 @@ -d3 = {version: "0.15.2"}; // semver +d3 = {version: "0.15.3"}; // semver diff --git a/src/core/transition.js b/src/core/transition.js index 1dbd58f5..c53ca22e 100644 --- a/src/core/transition.js +++ b/src/core/transition.js @@ -122,7 +122,7 @@ function d3_transition(groups) { function styleTween(d, i) { var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); return function(t) { - this.style.setProperty(name, i(t), priority); + this.style.setProperty(name, f(t), priority); }; }