Skip to content

Commit 5d2416d

Browse files
committed
Fix antemeridian cutting.
1 parent cba8a77 commit 5d2416d

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

d3.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5611,7 +5611,7 @@
56115611
var n = ringSegments.length;
56125612
if (!n) return;
56135613
count += n;
5614-
if (x[0] !== false) {
5614+
if (typeof x[0] === "number") {
56155615
var segment = ringSegments[0], point = segment[0], n = segment.length - 1, i = 0;
56165616
context.moveTo(point[0], point[1]);
56175617
while (++i < n) context.lineTo((point = segment[i])[0], point[1]);
@@ -6241,7 +6241,7 @@
62416241
var point = rotatePoint(coordinates);
62426242
context.point(point[0], point[1]);
62436243
},
6244-
line: function(coordinates, context) {
6244+
line: function(coordinates, context, winding) {
62456245
if (!(n = coordinates.length)) return;
62466246
var point = rotatePoint(coordinates[0]), λ0 = point[0], φ0 = point[1], λ1, φ1, sλ0 = λ0 > 0 ? π : -π, sλ1, , i = 0, n;
62476247
context.moveTo(λ0, φ0);
@@ -6266,6 +6266,7 @@
62666266
}
62676267
sλ0 = sλ1;
62686268
}
6269+
if (winding != null) context.closePath();
62696270
},
62706271
polygon: function(polygon, context) {
62716272
d3_geo_circleClipPolygon(polygon, context, clip.line, d3_geo_antemeridianInterpolate, d3_geo_antemeridianAngle);

d3.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geo/circle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function d3_geo_circleClipPolygon(coordinates, context, clipLine, interpolate, a
186186
if (!n) return;
187187
count += n;
188188

189-
if (x[0] !== false) {
189+
if (typeof x[0] === "number") {
190190
var segment = ringSegments[0],
191191
point = segment[0],
192192
n = segment.length - 1,

src/geo/projection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function d3_geo_projectionCutAntemeridian(rotatePoint) {
198198
var point = rotatePoint(coordinates);
199199
context.point(point[0], point[1]);
200200
},
201-
line: function(coordinates, context) {
201+
line: function(coordinates, context, winding) {
202202
if (!(n = coordinates.length)) return;
203203
var point = rotatePoint(coordinates[0]),
204204
λ0 = point[0],
@@ -233,6 +233,7 @@ function d3_geo_projectionCutAntemeridian(rotatePoint) {
233233
}
234234
sλ0 = sλ1;
235235
}
236+
if (winding != null) context.closePath();
236237
},
237238
polygon: function(polygon, context) {
238239
d3_geo_circleClipPolygon(polygon, context, clip.line, d3_geo_antemeridianInterpolate, d3_geo_antemeridianAngle);

0 commit comments

Comments
 (0)