Commit b86e4e4a authored by Mike Bostock's avatar Mike Bostock
Browse files

Getter support for transition.{delay,duration}.

Fixes #1773.
parent 28538c40
......@@ -8578,6 +8578,7 @@
};
d3_transitionPrototype.delay = function(value) {
var id = this.id;
if (arguments.length < 1) return this.node().__transition__[id].delay;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node.__transition__[id].delay = +value.call(node, node.__data__, i, j);
} : (value = +value, function(node) {
......@@ -8586,6 +8587,7 @@
};
d3_transitionPrototype.duration = function(value) {
var id = this.id;
if (arguments.length < 1) return this.node().__transition__[id].duration;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j));
} : (value = Math.max(1, value), function(node) {
......
This diff is collapsed.
......@@ -3,6 +3,7 @@ import "transition";
d3_transitionPrototype.delay = function(value) {
var id = this.id;
if (arguments.length < 1) return this.node().__transition__[id].delay;
return d3_selection_each(this, typeof value === "function"
? function(node, i, j) { node.__transition__[id].delay = +value.call(node, node.__data__, i, j); }
: (value = +value, function(node) { node.__transition__[id].delay = value; }));
......
......@@ -3,6 +3,7 @@ import "transition";
d3_transitionPrototype.duration = function(value) {
var id = this.id;
if (arguments.length < 1) return this.node().__transition__[id].duration;
return d3_selection_each(this, typeof value === "function"
? function(node, i, j) { node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j)); }
: (value = Math.max(1, value), function(node) { node.__transition__[id].duration = value; }));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment