Skip to content

Commit

Permalink
Merge branch 'fix-firefox'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 10, 2015
2 parents 0d639ef + 959da21 commit 45a2064
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 144 deletions.
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"animation",
"canvas"
],
"version": "3.5.7",
"version": "3.5.8",
"main": "d3.js",
"scripts": [
"d3.js"
Expand Down
114 changes: 58 additions & 56 deletions d3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!function() {
var d3 = {
version: "3.5.7"
version: "3.5.8"
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
Expand Down Expand Up @@ -8902,9 +8902,64 @@
var lock = node[ns] || (node[ns] = {
active: 0,
count: 0
}), transition = lock[id];
}), transition = lock[id], time, timer, duration, ease, tweens;
function schedule(elapsed) {
var delay = transition.delay;
timer.t = delay + time;
if (delay <= elapsed) return start(elapsed - delay);
timer.c = start;
}
function start(elapsed) {
var activeId = lock.active, active = lock[activeId];
if (active) {
active.timer.c = null;
active.timer.t = NaN;
--lock.count;
delete lock[activeId];
active.event && active.event.interrupt.call(node, node.__data__, active.index);
}
for (var cancelId in lock) {
if (+cancelId < id) {
var cancel = lock[cancelId];
cancel.timer.c = null;
cancel.timer.t = NaN;
--lock.count;
delete lock[cancelId];
}
}
lock.active = id;
transition.event && transition.event.start.call(node, node.__data__, i);
tweens = [];
transition.tween.forEach(function(key, value) {
if (value = value.call(node, node.__data__, i)) {
tweens.push(value);
}
});
ease = transition.ease;
duration = transition.duration;
timer.c = tick;
d3_timer(function() {
if (timer.c && tick(elapsed || 1)) {
timer.c = null;
timer.t = NaN;
}
return 1;
}, 0, time);
}
function tick(elapsed) {
var t = elapsed / duration, e = ease(t), n = tweens.length;
while (n > 0) {
tweens[--n].call(node, e);
}
if (t >= 1) {
transition.event && transition.event.end.call(node, node.__data__, i);
if (--lock.count) delete lock[id]; else delete node[ns];
return 1;
}
}
if (!transition) {
var time = inherit.time, timer = d3_timer(schedule, 0, time);
time = inherit.time;
timer = d3_timer(schedule, 0, time);
transition = lock[id] = {
tween: new d3_Map(),
time: time,
Expand All @@ -8916,59 +8971,6 @@
};
inherit = null;
++lock.count;
function schedule(elapsed) {
var delay = transition.delay, duration, ease, tweened = [];
timer.t = delay + time;
if (delay <= elapsed) return start(elapsed - delay);
timer.c = start;
function start(elapsed) {
var activeId = lock.active, active = lock[activeId];
if (active) {
active.timer.c = null;
active.timer.t = NaN;
--lock.count;
delete lock[activeId];
active.event && active.event.interrupt.call(node, node.__data__, active.index);
}
for (var cancelId in lock) {
if (+cancelId < id) {
var cancel = lock[cancelId];
cancel.timer.c = null;
cancel.timer.t = NaN;
--lock.count;
delete lock[cancelId];
}
}
lock.active = id;
transition.event && transition.event.start.call(node, node.__data__, i);
transition.tween.forEach(function(key, value) {
if (value = value.call(node, node.__data__, i)) {
tweened.push(value);
}
});
ease = transition.ease;
duration = transition.duration;
timer.c = tick;
d3_timer(function() {
if (timer.c && tick(elapsed || 1)) {
timer.c = null;
timer.t = NaN;
}
return 1;
}, 0, time);
}
function tick(elapsed) {
var t = elapsed / duration, e = ease(t), n = tweened.length;
while (n > 0) {
tweened[--n].call(node, e);
}
if (t >= 1) {
transition.event && transition.event.end.call(node, node.__data__, i);
if (--lock.count) delete lock[id]; else delete node[ns];
return 1;
}
}
}
}
}
d3.svg.axis = function() {
Expand Down
2 changes: 1 addition & 1 deletion d3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Package.describe({
name: "d3js:d3", // http://atmospherejs.com/d3js/d3
summary: "D3 (official): A JavaScript visualization library for HTML and SVG.",
version: "3.5.7",
version: "3.5.8",
git: "https://github.com/mbostock/d3.git"
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3",
"version": "3.5.7",
"version": "3.5.8",
"description": "A JavaScript visualization library for HTML and SVG.",
"keywords": [
"dom",
Expand Down
2 changes: 1 addition & 1 deletion src/start.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
!function(){
var d3 = {version: "3.5.7"}; // semver
var d3 = {version: "3.5.8"}; // semver
168 changes: 85 additions & 83 deletions src/transition/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,93 @@ function d3_transitionNamespace(name) {

function d3_transitionNode(node, i, ns, id, inherit) {
var lock = node[ns] || (node[ns] = {active: 0, count: 0}),
transition = lock[id];
transition = lock[id],
time,
timer,
duration,
ease,
tweens;

function schedule(elapsed) {
var delay = transition.delay;
timer.t = delay + time;
if (delay <= elapsed) return start(elapsed - delay);
timer.c = start;
}

function start(elapsed) {

// Interrupt the active transition, if any.
var activeId = lock.active,
active = lock[activeId];
if (active) {
active.timer.c = null;
active.timer.t = NaN;
--lock.count;
delete lock[activeId];
active.event && active.event.interrupt.call(node, node.__data__, active.index);
}

// Cancel any pre-empted transitions. No interrupt event is dispatched
// because the cancelled transitions never started.
for (var cancelId in lock) {
if (+cancelId < id) {
var cancel = lock[cancelId];
cancel.timer.c = null;
cancel.timer.t = NaN;
--lock.count;
delete lock[cancelId];
}
}

// Start the transition.
lock.active = id;
transition.event && transition.event.start.call(node, node.__data__, i);

// Initialize the tweens.
tweens = [];
transition.tween.forEach(function(key, value) {
if (value = value.call(node, node.__data__, i)) {
tweens.push(value);
}
});

// Defer capture to allow tween initialization to set ease & duration.
ease = transition.ease;
duration = transition.duration;

// Defer tween invocation to end of current frame; see mbostock/d3#1576.
// Note that this transition may be canceled before then!
timer.c = tick;
d3_timer(function() {
if (timer.c && tick(elapsed || 1)) {
timer.c = null;
timer.t = NaN;
}
return 1;
}, 0, time);
}

function tick(elapsed) {
var t = elapsed / duration,
e = ease(t),
n = tweens.length;

while (n > 0) {
tweens[--n].call(node, e);
}

if (t >= 1) {
transition.event && transition.event.end.call(node, node.__data__, i);
if (--lock.count) delete lock[id];
else delete node[ns];
return 1;
}
}

if (!transition) {
var time = inherit.time,
timer = d3_timer(schedule, 0, time);
time = inherit.time;
timer = d3_timer(schedule, 0, time);

transition = lock[id] = {
tween: new d3_Map,
Expand All @@ -74,85 +156,5 @@ function d3_transitionNode(node, i, ns, id, inherit) {
inherit = null; // allow gc

++lock.count;

function schedule(elapsed) {
var delay = transition.delay,
duration,
ease,
tweened = [];

timer.t = delay + time;
if (delay <= elapsed) return start(elapsed - delay);
timer.c = start;

function start(elapsed) {

// Interrupt the active transition, if any.
var activeId = lock.active,
active = lock[activeId];
if (active) {
active.timer.c = null;
active.timer.t = NaN;
--lock.count;
delete lock[activeId];
active.event && active.event.interrupt.call(node, node.__data__, active.index);
}

// Cancel any pre-empted transitions. No interrupt event is dispatched
// because the cancelled transitions never started.
for (var cancelId in lock) {
if (+cancelId < id) {
var cancel = lock[cancelId];
cancel.timer.c = null;
cancel.timer.t = NaN;
--lock.count;
delete lock[cancelId];
}
}

// Start the transition.
lock.active = id;
transition.event && transition.event.start.call(node, node.__data__, i);

// Initialize the tweens.
transition.tween.forEach(function(key, value) {
if (value = value.call(node, node.__data__, i)) {
tweened.push(value);
}
});

// Defer capture to allow tween initialization to set ease & duration.
ease = transition.ease;
duration = transition.duration;

// Defer tween invocation to end of current frame; see mbostock/d3#1576.
// Note that this transition may be canceled before then!
timer.c = tick;
d3_timer(function() {
if (timer.c && tick(elapsed || 1)) {
timer.c = null;
timer.t = NaN;
}
return 1;
}, 0, time);
}

function tick(elapsed) {
var t = elapsed / duration,
e = ease(t),
n = tweened.length;

while (n > 0) {
tweened[--n].call(node, e);
}

if (t >= 1) {
transition.event && transition.event.end.call(node, node.__data__, i);
if (--lock.count) delete lock[id];
else delete node[ns];
return 1;
}
}
}
}
}

0 comments on commit 45a2064

Please sign in to comment.