Don’t try to round corners on tiny arcs.

Fixes #2183 #2194.
This commit is contained in:
Mike Bostock 2015-10-22 14:05:02 -07:00
Родитель ca6e944aeb
Коммит c9e974504d
3 изменённых файлов: 3 добавлений и 3 удалений

2
d3.js поставляемый
Просмотреть файл

@ -7981,7 +7981,7 @@
} else {
x2 = y2 = 0;
}
if ((rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
if (da >= ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
cr = r0 < r1 ^ cw ? 0 : 1;
var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
if (x1 != null) {

2
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -95,7 +95,7 @@ d3.svg.arc = function() {
}
// Compute the rounded corners.
if ((rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > 1e-3) {
if (da >= ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > 1e-3) {
cr = r0 < r1 ^ cw ? 0 : 1;
// Compute the angle of the sector formed by the two sides of the arc.