I think this gives a better experience on big monitors. :-) I've also used
d3.timer to update the paths in case there is a backlog of mousemove events.
I'm not sure this is necessary but in testing on a fast machine sometimes it
processes two mousemove events and only draws the most recent one with this
change.
This reverts commit c5450fa62a.
It turns out this approximation is not that much faster than Math.{sin,cos}; I
think the perceived performance is more related to the responsiveness to the
"mousemove" event.
The input to the layout is now an array of edges to bundle, rather than nodes.
This eliminates the need for an `outgoing` accessor, since the links are passed
to the bundle layout directly.
The svg line generator now supports a beta (straightening; bundle strength)
parameter. I haven't decided if this is the right place or the right name for
it, but it seems like a reasonable starting point. I'm not happy with the cos &
sin needed to produce radial lines (both here and for the diagonal projection in
other examples), but I don't have a good alternative yet.
This commit also tries to make the construction of the links from the layout
nodes a bit easier to follow. The previous code was used another intermediate
representation, and I think it's cleaner to construct the default format
expected by the layouts. However, there's still a good chunk of code required to
massage the JSON format into a node hierarchy and array of dependencies, so I'd
like to find a way to simplify that, too.
Firstly, when the mouse exits the area the gravity coordinates are nullified.
Secondly, if the user switches to another window, the gravity coordinates are
nullified (otherwise the appropriate "mouseout" event may be missed).
This was accidentally hidden by the drag behavior. Probably, the drag behavior
should be broken out and moved to the d3.behavior module. But this is a nice fix
for the immediate problem of name collision. Fixes#192.
This way, people can play with superformulas if they want them, but we keep the
core library small. If we want to replace the default symbol implementation with
superformulas in the future, we can do that too. For now, be conservative.
This is useful when other modules want to register interpolators for
d3.interpolate without adding an explicit dependency to d3.core. The
interpolators are applied in reverse order, and the first one that returns
a function is used.
(This commit was authored by @jasondavies and cherry picked.)
The subclasses can't use the same object as the parent class, because they are
functions. But, there's no reason to duplicate the code that rebinds the methods
onto the subclass.
If the tween function returns null, then no tween will be applied for the
specified element. The default tween function now returns null if the start and
end value are the same, thus avoiding redundant interpolation.