Previously, null nodes were passed to the comparator and were indistinguishable
from non-null nodes with no bound data. For consistency with other selection
operators that skip null nodes, it seems preferrable to put null nodes at the
end of the selection rather than passing them to the comparator. Fixes#881.
While I abhor Prototype’s practice of replacing native methods with broken non-
native ones, this is a painless fix that allows us to use d3.geom.voronoi on
nytimes.com, which shamefully continues to use Prototype.
Some time ago the hidden div scroll trick stopped working. But, this went nearly
unnoticed because most browsers are fairly well behaved since WebKit fixed bug
https://bugs.webkit.org/show_bug.cgi?id=40441 back in June 2010. All that
remained broken was Firefox, who adopted the newer W3C "wheel" event standard.
This commit removes the old div hack, and does better support detection to
determine the most standards-based approach to listening for wheel events.
This avoids an inconsistency (discussed in #1044) when using D3 inside Node.js,
where D3 internally creates a JSDOM document during initialization, but then
subsequently depends on the current global document, which is not exposed. D3
now always refers to the global document at the time of initialization, and
does not depend on the current global document or window.
This incorporates two enhancements:
1. A simpler formulation for the area of a spherical triangle with one
vertex at the south pole.
2. Instead of calling atan2 for every point, we use the identity:
∑ arg(z) = arg(∏ z),
where z is a complex number, and only call atan2 once for each
polygon, instead opting for a cheaper complex number multiplication
for each point.
This is around 3x faster than the old implementation as measured by the
included benchmark.
Now that D3 supports great-arc interpolation automatically for projections,
there is no need for a great arc feature generator, as a simple LineString
geometry object is equivalent. For the same reason, d3.geo.graticule does not
need to use supersampling on meridians, since meridians are great arcs.
This commit also adds d3.geo.distance(a, b) for computing the length of the
great arc between points a and b in radians, as a replacement for the
deprecated d3.geo.greatArc method, and a faster alternative to constructing a
d3.geo.interpolate solely to measure distance.
Fixes#1021#1024.
The update transition must be created after the domain path is entered, or else
the entering domain path will not be part of the update transition, and thus
will not have the "d" attribute computed correctly. Fixes#1022. This bug was
introduced by 8ee6c126bc to squash a warning!
The length of the exit selection is always the same as the length of the
original selection, independent of the data, so there is no need to compute the
maximum of the two lengths.
Fixes#997. The enter, update and exit selections are now initialized as fixed-
length arrays rather than dynamically populated with nulls. If duplicate keys
are used for either data or selected elements, only the first datum or element
is considered and subsequent data or elements are ignored.
Using relative hyperlinks here results in some weirdness when the
readme is displayed on npmjs.org.
If this patch lands, I'd suggest also doing `npm publish -f` (or
just bump the version in package.json and `npm publish` un-forcefully.)