mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
config redirect
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
import {selection} from "d3-selection";
|
||||
import selection_interrupt from "./interrupt.js";
|
||||
import selection_transition from "./transition.js";
|
||||
|
||||
selection.prototype.interrupt = selection_interrupt;
|
||||
selection.prototype.transition = selection_transition;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import interrupt from "../interrupt.js";
|
||||
|
||||
export default function(name) {
|
||||
return this.each(function() {
|
||||
interrupt(this, name);
|
||||
});
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import {Transition, newId} from "../transition/index.js";
|
||||
import schedule from "../transition/schedule.js";
|
||||
import {easeCubicInOut} from "d3-ease";
|
||||
import {now} from "d3-timer";
|
||||
|
||||
var defaultTiming = {
|
||||
time: null, // Set on use.
|
||||
delay: 0,
|
||||
duration: 250,
|
||||
ease: easeCubicInOut
|
||||
};
|
||||
|
||||
function inherit(node, id) {
|
||||
var timing;
|
||||
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
||||
if (!(node = node.parentNode)) {
|
||||
throw new Error(`transition ${id} not found`);
|
||||
}
|
||||
}
|
||||
return timing;
|
||||
}
|
||||
|
||||
export default function(name) {
|
||||
var id,
|
||||
timing;
|
||||
|
||||
if (name instanceof Transition) {
|
||||
id = name._id, name = name._name;
|
||||
} else {
|
||||
id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
||||
}
|
||||
|
||||
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
||||
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||||
if (node = group[i]) {
|
||||
schedule(node, name, id, i, group, timing || inherit(node, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id);
|
||||
}
|
||||
Reference in New Issue
Block a user