Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer first tick to end of timer frame. #1576

Merged
merged 4 commits into from Oct 10, 2013
Merged

Defer first tick to end of timer frame. #1576

merged 4 commits into from Oct 10, 2013

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Oct 9, 2013

Rather than interleave the initialization of transition tweens with their first tick, defer the first tick to the end of the current timer frame such that any DOM modifications that happen during the first tick do not trigger a forced relayout when another tween is initialized (e.g., getComputedStyle).

Rather than interleave the initialization of transition tweens with their first
tick, defer the first tick to the end of the current timer frame such that any
DOM modifications that happen during the first tick do not trigger a forced
relayout when another tween is initialized (e.g., getComputedStyle).
@wagenet
Copy link

wagenet commented Oct 10, 2013

This fixes the issue in my app, though I'm not qualified to say if it's good otherwise. Thanks!

Previously it was using Date.now(), which might be a millisecond or two past the
now time of the current frame, and thus might not run until the next frame! By
using the current time, we guarantee that it runs at the end of this frame.
@mbostock mbostock merged commit 3aaa728 into 3.3.7 Oct 10, 2013
mbostock added a commit that referenced this pull request Nov 13, 2015
This fixes a priority inversion where a transition B that is scheduled on
transition A’s start initializes its tweens before transition A has its first
tick. By scheduling transition A’s first tick before dispatching A’s start
event, it’s first tick is guaranteed to run before any new transition’s tweens
are initialized.

Related #1576 d3/d3-transition#16.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants