Skip to content

Commit 7712dcd

Browse files
committed
Restore support for empty & ccw polygons.
1 parent 4d268a7 commit 7712dcd

5 files changed

Lines changed: 8 additions & 18 deletions

File tree

d3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5638,7 +5638,7 @@
56385638
segments = segments.concat(ringSegments.filter(d3_geo_circleSegmentLength1));
56395639
});
56405640
if (!segments.length) {
5641-
if (visibleArea < 0 || invisible && invisibleArea < 0) {
5641+
if (visibleArea < 0 || invisible && invisibleArea <= 0) {
56425642
var moved = false;
56435643
interpolate(null, null, 1, {
56445644
lineTo: function(x, y) {
@@ -5829,7 +5829,7 @@
58295829
graticule.outline = function() {
58305830
return {
58315831
type: "Polygon",
5832-
coordinates: [ x(x0).concat(y(y1).slice(1), x(x1).reverse().slice(1), y(y0).reverse().slice(1)) ]
5832+
coordinates: [ [] ]
58335833
};
58345834
};
58355835
graticule.extent = function(_) {

d3.min.js

Lines changed: 2 additions & 2 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
@@ -229,7 +229,7 @@ function d3_geo_circleClipPolygon(coordinates, context, clipLine, interpolate) {
229229
});
230230

231231
if (!segments.length) {
232-
if (visibleArea < 0 || invisible && invisibleArea < 0) {
232+
if (visibleArea < 0 || invisible && invisibleArea <= 0) {
233233
var moved = false;
234234
interpolate(null, null, 1, {
235235
lineTo: function(x, y) {

src/geo/graticule.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ d3.geo.graticule = function() {
1818
graticule.outline = function() {
1919
return {
2020
type: "Polygon",
21-
coordinates: [
22-
x(x0).concat(
23-
y(y1).slice(1),
24-
x(x1).reverse().slice(1),
25-
y(y0).reverse().slice(1))
26-
]
21+
coordinates: [[]]
2722
};
2823
};
2924

test/geo/graticule-test.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,10 @@ suite.addBatch({
5757
},
5858

5959
"outline": {
60-
"returns a Polygon": function(graticule) {
60+
"returns an empty Polygon": function(graticule) {
6161
assert.deepEqual(graticule.outline(), {
6262
type: "Polygon",
63-
coordinates: [[
64-
[-90,-45],[-90,-42],[-90,-39],[-90,-36],[-90,-33],[-90,-30],[-90,-27],[-90,-24],[-90,-21],[-90,-18],[-90,-15],[-90,-12],[-90,-9],[-90,-6],[-90,-3],[-90,0],[-90,3],[-90,6],[-90,9],[-90,12],[-90,15],[-90,18],[-90,21],[-90,24],[-90,27],[-90,30],[-90,33],[-90,36],[-90,39],[-90,42],[-90,45],
65-
[-87,45],[-84,45],[-81,45],[-78,45],[-75,45],[-72,45],[-69,45],[-66,45],[-63,45],[-60,45],[-57,45],[-54,45],[-51,45],[-48,45],[-45,45],[-42,45],[-39,45],[-36,45],[-33,45],[-30,45],[-27,45],[-24,45],[-21,45],[-18,45],[-15,45],[-12,45],[-9,45],[-6,45],[-3,45],[0,45],[3,45],[6,45],[9,45],[12,45],[15,45],[18,45],[21,45],[24,45],[27,45],[30,45],[33,45],[36,45],[39,45],[42,45],[45,45],[48,45],[51,45],[54,45],[57,45],[60,45],[63,45],[66,45],[69,45],[72,45],[75,45],[78,45],[81,45],[84,45],[87,45],[90,45],
66-
[90,42],[90,39],[90,36],[90,33],[90,30],[90,27],[90,24],[90,21],[90,18],[90,15],[90,12],[90,9],[90,6],[90,3],[90,0],[90,-3],[90,-6],[90,-9],[90,-12],[90,-15],[90,-18],[90,-21],[90,-24],[90,-27],[90,-30],[90,-33],[90,-36],[90,-39],[90,-42],[90,-45],
67-
[87,-45],[84,-45],[81,-45],[78,-45],[75,-45],[72,-45],[69,-45],[66,-45],[63,-45],[60,-45],[57,-45],[54,-45],[51,-45],[48,-45],[45,-45],[42,-45],[39,-45],[36,-45],[33,-45],[30,-45],[27,-45],[24,-45],[21,-45],[18,-45],[15,-45],[12,-45],[9,-45],[6,-45],[3,-45],[0,-45],[-3,-45],[-6,-45],[-9,-45],[-12,-45],[-15,-45],[-18,-45],[-21,-45],[-24,-45],[-27,-45],[-30,-45],[-33,-45],[-36,-45],[-39,-45],[-42,-45],[-45,-45],[-48,-45],[-51,-45],[-54,-45],[-57,-45],[-60,-45],[-63,-45],[-66,-45],[-69,-45],[-72,-45],[-75,-45],[-78,-45],[-81,-45],[-84,-45],[-87,-45],[-90,-45]
68-
]]
63+
coordinates: [[]]
6964
});
7065
}
7166
},

0 commit comments

Comments
 (0)