Граф коммитов

1411 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock d44de8f0bf Merge remote-tracking branch 'origin/faster-select-suppression' into 3.3.9 2013-10-25 15:35:59 -07:00
Mike Bostock 19d98c6205 Merge remote-tracking branch 'origin/fix-tick-format-precision' into 3.3.9 2013-10-25 15:35:22 -07:00
Mike Bostock 91506b31ea Prefer selectstart to user-select.
Rather than both setting the user-select to none and suppressing the selectstart
event, we now prefer to suppress the selectstart event if supported. This avoids
redundantly setting the user-select style, which can be slow. Fixes #1599.
2013-10-25 14:53:47 -07:00
Mike Bostock d03648090c Reformat code. 2013-10-17 09:11:22 -07:00
Mike Bostock 1dd2f402c9 Shared point-based stream transform.
Rather than use d3_geo_transform, parts of d3.geo that need a point-based
geometry stream transform now use d3_geo_transformPoint, which is slightly more
efficient. (This is the same as the d3_geo_streamTransform that was removed in
ac9f51fa534f12de7bb9487fb89edcb8edfa3951.)
2013-10-16 09:13:43 -07:00
Mike Bostock 9c1cd93150 Refactor to reduce closures. 2013-10-16 08:47:09 -07:00
Jason Davies 855061dc98 Minor optimisation for projection.precision(0).
When resampling is turned off, d3_geo_resample can return a special
transform that only performs projection of points to 2D, rather than
performing any additional computations such as conversion to 3D
coordinates for resampling.
2013-10-15 22:43:09 +01:00
Mike Bostock ed54503fc7 Merge branch '3.3.8' 2013-10-14 08:56:31 -07:00
Mike Bostock 99e42fea52 Merge remote-tracking branch 'origin/hierarchy-children' into 3.3.8 2013-10-14 08:55:15 -07:00
Mike Bostock d0e63e9e96 Merge remote-tracking branch 'origin/import-tweaks' into 3.3.8 2013-10-14 08:54:43 -07:00
Mike Bostock c8a7d3d5be Minor optimization. 2013-10-11 21:21:26 -07:00
Mike Bostock 6fd46253a3 Quantize sites. Fixes #1578. 2013-10-11 21:06:01 -07:00
Mike Bostock 4b36e850dc Fix when Voronoi cell is outside clip extent.
We we’re distinguishing between the case where the cell completely surrounds the
clip extent and where the cell does not intersect the clip extent at all.
Related #1578.
2013-10-11 11:41:02 -07:00
Jason Davies 2a7d873b3f Rename d3_svg_line{X,Y} to d3_geom_point{X,Y}.
Also, add a number of missing imports: mainly "math/abs".

Fixes #1581.
2013-10-11 16:12:03 +01:00
Jason Davies 7b4a772f49 Remove the children array for childless nodes.
If data is updated so that some nodes no longer have children, and a
custom children accessor is used, then the children array was not being
removed for such nodes, which meant that hierarchical layouts were
incorrectly taking into account these children.

Fixes #1579.
2013-10-11 11:41:55 +01:00
Mike Bostock e3c3e5487c Revert b0659e0ce2.
This appears to cause a significant performance regression as shown in the
rotating Ocean example (http://bl.ocks.org/mbostock/6713736): performance went
from 60 FPS to 20 FPS.
2013-10-10 17:19:13 -07:00
Mike Bostock af6a4e027e Merge branch '3.3.7' 2013-10-10 16:46:19 -07:00
Mike Bostock 0103e25850 Minify the hard way. 2013-10-10 08:44:29 -07:00
Mike Bostock cde0176ed2 Minify the hard way. 2013-10-10 08:36:59 -07:00
Mike Bostock 1a7fb59bd2 Small optimization. 2013-10-10 08:26:30 -07:00
Mike Bostock 8ed6883362 Ensure that the deferred tick runs this frame.
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.
2013-10-09 21:22:44 -07:00
Mike Bostock aa2a916435 Shorten. 2013-10-09 16:53:12 -07:00
Mike Bostock b093c2d3d3 Defer first tick to end of timer frame.
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).
2013-10-09 16:46:23 -07:00
Mike Bostock 017e64074f Reverse order of polygons.
This makes d3.geom.voronoi consistent with d3.geom.polygon and older versions.
2013-10-09 14:43:35 -07:00
Mike Bostock ab53db6ec7 Slightly shorter. 2013-10-09 09:07:16 -07:00
Mike Bostock 07e47a5be9 Shorten slightly. 2013-10-09 08:43:03 -07:00
Mike Bostock ec2eadb1fe Fix a bug in d3.merge optimization.
The d3.merge operator must always return a new array, but it wasn’t in the case
where a one-element array was passed. This implementation is still quite fast
but always returns a new array.
2013-10-09 08:41:42 -07:00
Mike Bostock cc00e66100 Remove superfluous elses. 2013-10-09 08:13:22 -07:00
Mike Bostock 097a3a07ba Bump version. 2013-10-09 08:10:05 -07:00
Mike Bostock 8c1a705969 Merge remote-tracking branch 'origin/fix-cross-document' into 3.3.7 2013-10-09 08:09:35 -07:00
Mike Bostock 7af610b89f Merge remote-tracking branch 'origin/fix-ie9-insert-before' into 3.3.7 2013-10-09 08:09:07 -07:00
Mike Bostock ddff8719dd Merge branch 'less-confusing-force-start' into 3.3.7 2013-10-09 08:08:27 -07:00
Mike Bostock 261940aa54 Merge remote-tracking branch 'origin/geo-rings' into 3.3.7
Conflicts:
	src/geo/clip-antimeridian.js
2013-10-09 08:07:55 -07:00
Mike Bostock b641eb58b3 Use the owner document to create new elements.
Fixes #1533 and avoids “wrong document” error when appending elements to a
different document than the one in which D3 was initialized.
2013-10-09 07:57:55 -07:00
Mike Bostock 0136ff9a39 Workaround IE9 insertBefore bug. Fixes #1566. 2013-10-07 15:27:41 -07:00
Mike Bostock dc8a61595f Simplify. 2013-10-07 09:06:01 -07:00
Mike Bostock 9e13eff5fd Simplify. 2013-10-07 09:00:34 -07:00
Mike Bostock ee2476b09c Use objects rather than arrays, cont. 2013-10-05 14:59:03 -07:00
Mike Bostock 8c443d9aee Restore d3.geom.delaunay. 2013-10-05 14:39:31 -07:00
Jason Davies 5a54a90f44 Optimise slightly. 2013-10-05 14:21:04 -07:00
Jason Davies 7a7d627f5b Simplify. 2013-10-05 14:20:59 -07:00
Jason Davies 78ceaabbd8 Better triplicate removal.
Only generate a triangle if the current site is has the minimum index.
This ensures only unique triangles are generated.
2013-10-05 14:20:55 -07:00
Mike Bostock c23a3b481e Not sure this is necessary? 2013-10-05 14:20:51 -07:00
Jason Davies 7910a7adbb Remove triplicate triangles. 2013-10-05 14:20:46 -07:00
Jason Davies 859d0c3818 Sort half-edges before generating triangles.
Also, ensure triangles are only generated for connected edges, which is
not always the case in unclosed (border) sites.
2013-10-05 14:20:41 -07:00
Mike Bostock ebf9a94ac7 Close, but not quite right. 2013-10-05 14:20:32 -07:00
Mike Bostock 4f51b3f37f Restore voronoi.links. 2013-10-05 14:20:25 -07:00
Mike Bostock 5bc83c30ad Use objects rather than arrays.
Turns out, o.x is much faster than o[0]!
2013-10-05 14:20:19 -07:00
Mike Bostock e405e1073e Shorten. 2013-10-05 14:20:05 -07:00
Mike Bostock e01e43e3a9 Shorten. 2013-10-05 14:20:00 -07:00
Mike Bostock 6f47f19d81 Shorten. 2013-10-05 14:19:54 -07:00
Mike Bostock 66ad0d2f6a Shorten. 2013-10-05 14:19:49 -07:00
Mike Bostock 83950eca4d Shorten. 2013-10-05 14:19:44 -07:00
Mike Bostock 23ebbb04cd Shorten. 2013-10-05 14:19:38 -07:00
Mike Bostock 87b663c282 Skip empty cells due to coincident nodes. 2013-10-05 14:19:33 -07:00
Mike Bostock 57e79a4489 Use the more conventional name “pool”. 2013-10-05 14:19:28 -07:00
Mike Bostock 1cb4a1a7b5 Only copy vertices for clipping as needed. 2013-10-05 14:19:28 -07:00
Mike Bostock 0a4d734b78 Fix clipping bug. 2013-10-05 14:19:19 -07:00
Mike Bostock 4b35157c77 Consolidate Liang–Barsky clipping implementations. 2013-10-05 14:19:12 -07:00
Mike Bostock 60a59fd5b9 Consolidate code. 2013-10-05 14:19:06 -07:00
Mike Bostock 683d5fb526 Shorter. 2013-10-05 14:19:00 -07:00
Mike Bostock 2377f7ccc4 Fix leak when removing nodes from rb-tree. 2013-10-05 14:18:54 -07:00
Mike Bostock 3c8808a842 Shorter. 2013-10-05 14:18:48 -07:00
Mike Bostock 3283e24ed1 Use null rather than undefined. 2013-10-05 14:18:39 -07:00
Mike Bostock 7ba007f5dd Alias Math.abs. 2013-10-05 14:18:31 -07:00
Mike Bostock 28d2d39cd8 Shorter words. 2013-10-05 14:14:59 -07:00
Mike Bostock e4bb8f988d Shorter words. 2013-10-05 14:14:53 -07:00
Mike Bostock 57b8379b69 Use clipExtent instead of bbox. 2013-10-05 14:14:53 -07:00
Mike Bostock d8fe51732a More shortening. 2013-10-05 14:14:48 -07:00
Mike Bostock 0531968e34 Shorter words. 2013-10-05 14:14:42 -07:00
Mike Bostock 2ce71eaaf7 More shorter names. 2013-10-05 14:14:42 -07:00
Mike Bostock 57d7c67de7 More shorter names. 2013-10-05 14:14:29 -07:00
Mike Bostock 0b5625ca3b Shorten member names. 2013-10-05 14:14:22 -07:00
Mike Bostock fa90206afd Use a simple [x, y] array for vertices. 2013-10-05 14:14:10 -07:00
Mike Bostock 54990ad4f0 Minor polish. 2013-10-05 14:13:51 -07:00
Mike Bostock e6740d16ad Restructure Voronoi implementation using SMASH. 2013-10-05 14:13:24 -07:00
Mike Bostock 04bbf9f318 Checkpoint new Voronoi implementation.
Still significant work left to minimize the size of the implementation, and
restore support for Delaunay meshes, but this provides a starting point.
2013-10-05 14:10:26 -07:00
Mike Bostock c9e0b67948 Less confusing intialization of node positions.
Fixes #1561.
2013-10-05 10:31:24 -07:00
Jason Davies d23919fe82 Simplify. 2013-10-03 21:08:48 +01:00
Jason Davies 3ef3ae4617 Optimise. 2013-10-03 19:34:18 +01:00
Jason Davies b5b05d5c11 Some minor optimisations. 2013-10-03 17:20:44 +01:00
Jason Davies b0659e0ce2 Preserve polygon exterior/interior ring ordering.
According to GeoJSON, the first ring in a polygon should be the
exterior, and subsequent rings should be holes that are inside the
exterior ring.  This fix ensures that the rejoining of clipped segments
preserves these semantics, by generating multiple polygons if necessary
rather than generating all rings within a single polygon as it did
previously.

Fixes #1558.
2013-10-03 16:57:54 +01:00
Mike Bostock 2c93d9c192 Merge branch '3.3.6' 2013-09-26 14:38:51 -07:00
Mike Bostock c6f9932035 Update dependencies. 2013-09-26 14:38:01 -07:00
Mike Bostock 328cd9f17f Merge remote-tracking branch 'origin/fix-zero-duration-transitions' into 3.3.6 2013-09-26 14:26:06 -07:00
Mike Bostock d2ad436fed Don’t pollute an ordinal scale’s domain.
Fixes #1550. By using the copy of the new scale (which we make anyway for a
snapshot) we avoid polluting the scale’s domain with the old values when using
the scale as the key function for the tick data-join.
2013-09-26 14:08:16 -07:00
Jason Davies 9eb878ec7d Fix clipping bug for complex polygons.
Intersection points are sorted along the clipping region edge relative
to a particular point.  In the case of antimeridian clipping, this point
is the South pole.  Previously, the first intersection was assumed to be
an entering intersection, but this is not always the case.

The fix is to see whether the clip region start point (the point
relative to which sorting occurs) is inside or outside the polygon being
drawn.  If it is inside, then the first intersection point must be
outside, and so forth.

The same applies to d3.geo.clipExtent.  Provision was already made for
this, but this has now been optimised to use a single point instead of
picking one of the four corners.

Another optimisation was to reuse this clip region start point to
determine whether to interpolate all the way around the clip region
edge.  Previously, this was done by testing an arbitrary point in the
clip region.

The above fix seemed to have broken one of the tests, and this has been
fixed by modifying the point-in-polygon routine slightly to handle
points that might lie exactly on the polygon edge.

Finally, I noticed a regression with the recent clipExtent fix, where a
polygon incorrectly being marked as “clean” (no intersections) on a
per-ring instead of per-polygon basis.
2013-09-26 16:51:35 +01:00
Mike Bostock a76aed5852 Merge remote-tracking branch 'origin/fix-clip-extent' into 3.3.6 2013-09-25 12:53:21 -07:00
Mike Bostock 0bf3fc1721 Optimize hyperbolic functions.
Not used much, but still an improvement. http://jsperf.com/hyperbolics
2013-09-25 12:00:50 -07:00
Mike Bostock 876e764429 Yay τ! 2013-09-25 11:43:53 -07:00
Mike Bostock 88862d37c2 Consolidate. 2013-09-25 11:39:46 -07:00
Jason Davies db39176f24 Optimise. 2013-09-25 19:24:28 +01:00
Jason Davies 9b8792c13d Wrap longitudes in d3_geo_rotation. 2013-09-25 19:15:32 +01:00
Mike Bostock 863f618e4d Prevent tick at t = 0.
This is especially important for a zero-duration transition, where the duration
is actually one millisecond, and we want the only tick to be at t = 1.
2013-09-24 21:31:08 -07:00
Mike Bostock 58325a9419 Simplify. 2013-09-24 21:22:16 -07:00
Jason Davies 31ea7dc0f1 Perform winding order check on unrotated polygons.
We remove the rotation step that occurred prior to clipping, so that
clipping processes unrotated polygons.  Note that clip regions are
defined relative to the rotated globe, so clipping now needs a rotation
parameter.

Rather than moving the rotation step so it occurs after clipping, the
rotation occurs as part of clipping, using the rotation parameter to
rotate streamed points.  Alternatively, points could be clipped against
a rotated clip region, and then subsequently rotated as a separate step,
but this seems slightly less efficient.

Fixes #1453.
2013-09-24 20:39:33 +01:00
Jason Davies ba48daa1e4 Simplify. 2013-09-24 20:08:33 +01:00
Jason Davies b89c2d979b Fix clipExtent bug.
If a polygon does not intersect with the extent, but has one or more
rings inside the extent, then the extent should be checked to see
whether it is inside the polygon: if so, an additional exterior ring is
generated.

Previously, this check was only made if there were no visible rings at
all.

Fixes an issue noticed in #1453.
2013-09-24 19:03:23 +01:00
Mike Bostock 7bb322f645 Merge branch 'fix-implicit-ordinal-domain' 2013-09-21 11:49:09 -07:00
Mike Bostock 113032bc97 Restrict implicit domains to explicit ranges.
When an ordinal scale’s range is explicitly defined as an array of values, we
can build the domain implicitly by progressively assigning values from the
range; this is commonly done with color palettes, for example.

However, when an ordinal scale’s range is rather implied by chopping a
continuous range into a series of points or bands, then the domain must be
specified explicitly: for the scale to be consistent, we need to know the
cardinality of the domain to compute the implied range values.

Thus, it only makes sense to extend the domain implicitly when the range is
specified explicitly. Fixes #1536 #1535.
2013-09-21 10:37:15 -07:00
Mike Bostock 9ca071eee7 Merge branch '3.3.4' 2013-09-18 20:52:44 -07:00
Mike Bostock 0d57d390b3 Merge remote-tracking branch 'origin/fix-time-degenerate-ticks' into 3.3.4 2013-09-18 20:51:35 -07:00
Mike Bostock 874bf96116 Merge remote-tracking branch 'origin/fix-axis-tick-key' into 3.3.4 2013-09-18 20:51:12 -07:00
Mike Bostock 9405e4518a Merge remote-tracking branch 'origin/fix-geo-pip' into 3.3.4 2013-09-18 20:50:12 -07:00
Mike Bostock 90d06cf08d Fix crash in ticks for empty d3.time.scale domain.
Fixes #1525. This was only an issue because the domain is extended by one
millisecond when it is empty (for an inclusive upper bound).
2013-09-18 20:36:54 -07:00
Mike Bostock 06e2077ff8 Use the scale as the tick key function.
Previously we were using string coercion as the key function for axis ticks.
However, when the stringified value of the tick does not fully capture the
representation (such as a date with millisecond precision, whose string form
only has second precision; fixes #1529), string coercion is insufficient.

Fortunately, there is an equivalently-simple key function for tick identity: the
scale! If the scale does not return a unique position for the given tick, then
the tick would be overlapping, so it serves perfectly as the key function.
2013-09-18 20:12:45 -07:00
Jason Davies eff0a11615 Fix point-in-polygon for multiple polar rings.
Instead of detecting if any single polygon ring winds around a pole, we
consider the cumulative winding of all polygon rings together.  This is
consistent with the area calculation, which considers the cumulative
area total of all rings.

This fixes #1521: an issue with the Hammer Retroazimuthal projection,
which uses such a polygon with two rings, covering most of the globe.

In addition, drop the special handling of points at the south pole,
which might have been there to pass an incorrect test: a CCW triangle
touching the south pole, which was probably incorrectly thought to be
clockwise.  This fixes an issue with a “stripe” polygon rotated so that
a point is at the south pole, mentioned in #1453.
2013-09-17 00:09:47 +01:00
Jason Davies 25630484b8 Remove dead code.
This line doesn’t appear to do anything useful, since the parent node is
now saved in the closure.  Previously, this line checked to see if
target.parentNode was null, since this would cause a crash when
computing the relative position.
2013-09-05 22:24:46 +01:00
Jason Davies 5f8056c1e4 Fix d3.mouse touch fallback for HTML targets. 2013-09-05 19:53:01 +01:00
Mike Bostock a83ff054c9 Merge branch '3.3.3' 2013-09-05 11:21:15 -07:00
Mike Bostock e67138acc9 Merge branch 'zoom-multiple' into 3.3.3 2013-09-05 11:20:40 -07:00
Mike Bostock 2378ab8f79 Merge branch 'time-parse-zone' into 3.3.3 2013-09-05 11:20:07 -07:00
Mike Bostock d512a78d85 Remove redundant code in d3.svg.brush.
Now that d3.mouse does the “right thing” for touch events, we don’t need code
that handles touch events specially.
2013-09-05 10:52:56 -07:00
Mike Bostock 8dc4ed81af If present, use changedTouches[0] for d3.mouse.
Normally d3.mouse(this) is equivalent to d3.touches(this)[0] because the clientX
and clientY properties of the event and the first touch are the same. However,
on touchend the touches list is empty, and the clientX and clientY are 0! So
instead it seems safer to use the position of the first changed touch for the
default location of a touch event.
2013-09-05 10:31:39 -07:00
Mike Bostock 39cb7e6df6 Add a few comments. 2013-09-04 22:37:25 -07:00
Jason Davies 637fa99162 Tweak return value on touchend.
For consistency, always return undefined here.
2013-08-31 16:34:03 +01:00
Jason Davies ce12faee3b Ensure that touch{move,end} listeners are removed.
Previously, if there were globally-active touches remaining, a given
zoom gesture was not ended even if locations0 was empty.  This fixes the
problem by checking to see if locations0 is empty.  If so, the gesture
is ended.
2013-08-31 15:10:00 +01:00
Jason Davies 85e738eac2 Rename for consistency. 2013-08-31 11:10:10 +01:00
Jason Davies 36b8a0b1ff Optimise.
This block is only necessary if there are remaining touches, because
otherwise the gesture has ended and we remove this closure along with
locations0.  Thanks, @mbostock!
2013-08-31 01:29:59 +01:00
Jason Davies abc9dbb07f Use distance instead of d3.event.scale.
Unlike d3.event.scale, which is a single value provided by the browser
(usually an average based on the position of all touches), we can
compute separate distances for each zoom gesture and its target,
allowing multiple gestures to occur simultaneously.
2013-08-31 01:09:24 +01:00
Jason Davies 340b1675b4 Remove locations on touchend.
This avoids a potential bug where a touch identifier might be reused in
another gesture, but could still be referenced in locations0, thus
causing problems for the old gesture on touchmove.
2013-08-31 00:51:35 +01:00
Jason Davies 4b3795e195 Support simultaneous zooming on multiple targets.
Fixes #1497, where a zoom gesture would break if a touch was started
outside the target during a gesture.

Each zoom gesture now only considers touches that were started on its
associated target element.  This allows multiple zoom gestures to occur
at once without conflicts.
2013-08-30 23:10:48 +01:00
Jason Davies 7e2cf5adfc Support parsing timezone offsets.
Note that the resulting Date object can only be in the local timezone
(or UTC), due to the limitations of JavaScript Dates.

Fixes #1494.
2013-08-28 10:05:30 +01:00
Mike Bostock fc5a586414 Fix missing d3.transition in IE. Fixes #1491.
IE doesn’t support __proto__ patching, so if the selection.prototype.transition
method isn’t yet defined at the time d3_selectionRoot is defined, it won’t
inherit the method when the prototype is patched later! This restores the
original order of dependencies so that the transition method is defined before
d3_selectionRoot is created.
2013-08-26 22:39:58 -07:00
Mike Bostock 354f54dd32 Bump version. 2013-08-23 14:18:53 -07:00
Mike Bostock 64eca0ae47 Merge remote-tracking branch 'origin/geo-circle-precision' into 3.3.1 2013-08-23 14:18:14 -07:00
Mike Bostock 16e4c01405 Merge remote-tracking branch 'origin/time-parse-padding' into 3.3.1 2013-08-23 14:17:41 -07:00
Mike Bostock 23a2d7d1f3 Remove major class from axis ticks.
The major class is now obsolete with the removal of tick subdivision.
2013-08-23 14:15:30 -07:00
Jason Davies 7b63274795 Simplify. 2013-08-23 21:09:32 +01:00
Jason Davies 8f4d0ac3ac Fix #1483; time parsing with padding modifier. 2013-08-23 18:51:59 +01:00
Mike Bostock cc74ee022b Optimize charge calculation. 2013-08-22 16:49:57 -07:00
Mike Bostock 14b6231e45 Limit charge distance. 2013-08-22 15:55:57 -07:00
Mike Bostock f59fc64a20 Release 3.3.0. 2013-08-21 21:08:52 -07:00
Mike Bostock fa2892ea47 Break infinite loop on invalid date. 2013-08-21 21:05:22 -07:00
Mike Bostock cc4a1d0f8b Support nice(count) and nice(interval, skip).
Fixes #1475.
2013-08-21 20:59:43 -07:00
Mike Bostock 762f984dfb Add generated file. 2013-08-21 12:16:21 -07:00
Mike Bostock 7f8c03e49b Save bytes by aliasing d3.time. 2013-08-21 12:08:37 -07:00
Mike Bostock e6551e5703 Compress slightly. 2013-08-21 11:57:51 -07:00
Mike Bostock 403a0dde49 Better time.nice and time.ticks. Fixes #1434. 2013-08-21 11:53:16 -07:00
Mike Bostock 53ce4bb6fc Minor optimization. 2013-08-19 11:13:10 -07:00
Mike Bostock 0c205254da Add d3.pairs. 2013-08-19 11:06:53 -07:00
Mike Bostock 8d9d2b7c30 Replace d3.geo.identity with d3.geo.clipExtent.
The only function of d3.geo.identity was to allow viewport clipping on the
identity projection, so it seems clearer to replace d3.geo.identity with a
geometry transform that is explicitly tailored to viewport clipping.
2013-08-19 10:55:39 -07:00
Mike Bostock b196e401c8 Limit streamed coordinates to three dimensions.
Unfortunately, it seems that generically applying the point coordinates are
arguments prevents certain optimizations by the JavaScript runtime. If we
instead limit geometry streaming to three dimensions, this still allows us to
perform dynamic transformations based on arbitrary data.
2013-08-16 11:34:51 -07:00
Mike Bostock ac9f51fa53 Replace d3.geo.simplify with d3.geo.transform.
Rather than exposing a geometry transformation that is limited to filtering
points based on a minimum z value, this commit introduces a more generic method
of constructing streaming geometry transformations. This eliminates some of the
wrapper code used previously to create transforms.

This commit also restructures the implementation in core/array to remove a
dependency on core/document; instead, core/document now depends on core/array
and redefines the implementation of d3_array for broken browsers.
2013-08-16 10:28:11 -07:00
Mike Bostock 508ae65eec Add d3.geo.simplify.
Assumes that the third dimension (z) of each coordinate represents the
importance of that coordinate, and implements a filter stream that skips
coordinates that fail to meet the minimum importance threshold.
2013-08-15 14:59:05 -07:00
Mike Bostock 36e5526feb Don’t floor brush extent.
When the brush extent is set explicitly, use the exact values to set the
displayed position of the brush, rather than flooring the pixel coordinates.
This ensures a consistent appearance with other elements, such as an axis, that
may be rendered with shape-rendering: crispEdges.
2013-08-15 12:17:45 -07:00
Mike Bostock 1c88fc2fc5 Allow submillisecond transition timing.
Although submillisecond timing probably isn’t important for a single transition,
error can accumulate over time with chained transitions, so it’s important to
allow submillisecond timing for long-running looped transitions.
2013-08-15 10:03:30 -07:00
Mike Bostock 181656196c Defer persistence until transition start.
The zoom behavior was immediately persisting the new view when the transition
was scheduled, rather than waiting until the transition started. By waiting
until the transition starts, it’s possible to schedule chained transitions to
different views.
2013-08-15 09:30:01 -07:00
Mike Bostock f030c61d56 Cleanup transition after end.
Previously, the transition would delete itself prior to notifying any  end event
listeners. This could cause a crash when trying to schedule a chained transition
when a transition ends. To fix this, we now defer the deletion of the transition
until after the end event is dispatch.

This commit also makes a few tests that depended on the order in which tweens
were invoked a little more robust: the state after a transition ends is
inspected in the next tick after, rather than during, the end event.
2013-08-15 09:22:10 -07:00
Mike Bostock 806db97c5f Oops, saved too many bytes. 2013-08-14 20:55:29 -07:00
Mike Bostock 5ea3de2bb1 Save a few bytes. 2013-08-14 20:52:57 -07:00
Mike Bostock a83d89d777 Interrupt zoom transition on zoomstart. 2013-08-14 20:47:49 -07:00
Mike Bostock 48a4871c99 Smooth and efficient zooming and panning.
Based on the interpolate-zoom plugin. Required adding a zoom.size method to
specify the viewport size of the zoomable area.
2013-08-14 20:07:14 -07:00
Mike Bostock 079db13a7c First cut at zoom transitions. 2013-08-14 17:30:08 -07:00
Mike Bostock f5fc306323 Make event dispatching explicit.
Rather than dispatch brush events implicitly as part of selection.call or
transition.call, there is now a brush.event method which can be similarly called
to dispatch events. This way, the user can control when (or if) the events get
dispatched, and avoid unexpected events.
2013-08-14 17:19:58 -07:00
Mike Bostock de30d65811 Fix event dispatch on initial render. 2013-08-14 13:38:21 -07:00
Mike Bostock 24f9f2cd69 Store brush transition state on the DOM.
Rather than capture the brush’s pre-transition state via closure, store the
state on the DOM like the axis component (this.__chart__). Now the brush can be
instanced on multiple elements, and each element’s pre-transition state can be
tracked separately, consistent with its display.

Further, restore the pre-transition state of the brush prior to emitting the
brushstart event, using the pre-transition data-space extent, if any. And
likewise, when the transition ends, restore the post-transition data-space
extent if available, rather than the less accurate pixel-space extent. Since the
data-space extent is restored when the transition ends, an additional brush
event is now emitted prior to brushend, since the extent may have changed.
2013-08-14 13:08:10 -07:00
Mike Bostock dddb501165 Disable highlight tap on Android & iOS. 2013-08-14 09:58:28 -07:00
Mike Bostock 123646a82c Stream caching for d3.geo.identity. 2013-08-13 14:37:08 -07:00
Mike Bostock 1c18bcdc58 Bump version. 2013-08-13 14:19:07 -07:00
Mike Bostock 08d791f69d Merge remote-tracking branch 'origin/remove-tick-subdivide' into 3.3 2013-08-13 14:17:26 -07:00
Mike Bostock b6b64946ce Merge branch 'zoom-center' into 3.3
Conflicts:
	src/behavior/zoom.js
2013-08-13 14:16:39 -07:00
Mike Bostock d11205b4d9 Merge remote-tracking branch 'origin/geo-identity' into 3.3 2013-08-13 14:13:55 -07:00
Mike Bostock b82d85ca3d Merge branch 'scale-nice' into 3.3 2013-08-13 14:13:21 -07:00
Mike Bostock 5203dc132c Merge branch 'xhr-beforesend' into 3.3 2013-08-13 14:12:43 -07:00
Mike Bostock 2fbae9680d Merge branch 'zoom-events' into 3.3 2013-08-13 14:12:06 -07:00
Mike Bostock f1e796a99f Restructure state to shave a few bytes. 2013-08-13 11:00:38 -07:00
Mike Bostock e7a1ff72a8 Only notify when extent changes.
This avoids unnecessary work and some infinite loops.
2013-08-13 10:07:51 -07:00
Mike Bostock fb4f262440 Use the "brush" namespace for brush events. 2013-08-12 17:08:58 -07:00
Mike Bostock 9732e0c93e No brushstart and brushend on immediate change. 2013-08-12 16:50:08 -07:00
Mike Bostock f18298b8ae Simplify. 2013-08-12 16:47:39 -07:00
Mike Bostock 7bf2524be3 Interrupt transition on brushstart, if any. 2013-08-12 16:39:23 -07:00
Mike Bostock 1a54808d8f Fix copy-on-write on clear. 2013-08-12 16:35:17 -07:00
Mike Bostock 3a11f933ca Dispatch brush events on redraw.
The brush can interpolate its extent automatically during a transition,
dispatching brush events to notify listeners of the changing extent.
2013-08-12 16:34:19 -07:00
Mike Bostock 76d52a2396 Add brush transitions. Fixes #1385.
However, since the new extent is set to trigger the transition, this does not
provide interpolation of the extent in data-space, making it somewhat cumbersome
to perform live brush intersection during the transition.
2013-08-12 16:34:03 -07:00
Mike Bostock e7e6c3a616 Fix #1410 - add selection.interrupt.
This also changes the imports so that it’s possible to build a version of D3
with selections but without transitions.
2013-08-12 16:33:20 -07:00
Mike Bostock 3007e88970 Add axis.{inner,outer}TickSize. Fixes #1394. 2013-08-10 10:33:02 -07:00
Mike Bostock bd0ce6cab8 Remove axis.tickSubdivide. Fixes #1115. 2013-08-10 09:53:00 -07:00
Mike Bostock c7461b0de3 Add zoomstart and zoomend events. Fixes #1422. 2013-08-09 21:09:43 -07:00
Mike Bostock 9f59f949f3 Merge branch 'xhr-beforesend-event' of git://github.com/adnan-wahab/d3 into xhr-beforesend 2013-08-09 20:19:52 -07:00
Mike Bostock 1462c5f6df Save two bytes. 2013-08-05 10:47:22 -07:00
Mike Bostock 84793153d5 Fix #1437 - add identity projection.
The identity projection is equivalent to setting path.projection(null), except
that you can apply post-projection features such as viewport clipping.
2013-08-05 10:44:59 -07:00
Mike Bostock 7169511d5b Fix #1435 - use ten ticks by default.
This applies to linear.ticks and linear.tickFormat, and their equivalents on pow
and sqrt scales. In addition it changes the behavior of linear.nice() so that it
is equivalent to linear.nice(10) for consistency.
2013-08-02 15:03:24 -07:00
Mike Bostock 23ee2c08a6 Merge branch '3.2.8' 2013-08-01 07:37:51 -07:00
Mike Bostock 4c6b28d18f Merge branch 'map-copy-constructor' into 3.2.8 2013-08-01 07:37:00 -07:00
Mike Bostock b56349531c Merge branch 'fix-zoom-touch' into 3.2.8 2013-08-01 07:36:26 -07:00
Mike Bostock af85c4e497 Merge branch 'fix-degenerate-log-ticks' into 3.2.8 2013-08-01 07:36:02 -07:00
Mike Bostock 7f03c05c2d Merge branch 'fix-sort-null' into 3.2.8 2013-08-01 07:35:38 -07:00
Mike Bostock 4530a2e526 Style tweak. 2013-08-01 07:33:51 -07:00
Mike Bostock b32286cea7 Revert microoptimization of d3_number. 2013-08-01 07:31:53 -07:00
Mike Bostock 23904ccb70 Revert breakage of d3.{as,des}cending. 2013-08-01 07:30:31 -07:00
Mike Bostock 46472b1d67 Merge branch 'patch-3' of git://github.com/LeoDutra/d3 into micro-optimizations
Conflicts:
	src/core/array.js
2013-08-01 07:29:32 -07:00
Jason Davies 43f439e34f Minor optimisation. 2013-07-31 22:39:01 +01:00
Mike Bostock a85b05e803 Fix dbltap detection. 2013-07-31 14:31:22 -07:00
Jason Davies 993017ff22 Add a few comments. 2013-07-31 21:28:41 +01:00
adnan 6d20d95c91 add beforesend event to xhr. fixes #1397 2013-07-29 10:24:53 -07:00
Mike Bostock 0015231c07 Fix #1420 - regression with degenerate log ticks.
Commit 59554738 broke the check for a degenerate domain; this restores the
original check and adds a test to verify this behavior.
2013-07-24 14:13:12 -04:00
Jason Davies 120fb558a6 Fix issue with drag suppression for multitouch.
Due to the touchend listener being overwritten for every touchstart, two
touchstart events would result in d3_event_dragSuppress being called
twice, with only a single drag restore, meaning that a document's
user-select style could be lost.

This restructuring means that the first touchstart creates the closures
for subsequent touchstart, touchmove and touchend events.  A nice
side-benefit is that fewer closures are created for multitouch.
2013-07-23 23:23:38 +01:00
Jason Davies 2fd0227a67 Avoid binding multiple touch listeners for zoom.
For a two-finger pinch, if two touchstart events fire, this results in
two touchmove and touchend listeners.  The first will have a single
location in the locations variable, but its touchmove listener will
fire with two touches, causing it to fail due to not finding the
location of the second touch.

If the first listener fires before the second, this exception breaks
touch zooming (as no further listeners will be called), but the order is
undefined so may be browser/device dependent (for reproducing the bug).

Since zooming only ever involves a single gesture at a time, it makes
more sense to only have one listener of each type at a time, unlike
dragging, which involves multiple drag gestures at once.
2013-07-23 19:52:51 +01:00
Mike Bostock 4b839b655d More restrictive copy constructor.
Rather than duck-checking for a forEach method, limit the use of forEach to
d3_Map instances. In ECMAScript 6, the map.forEach method passes the callback
(value, key) rather than (key, value); likewise, array.forEach does the same.
2013-07-22 07:55:24 -04:00