Skip to content

Commit 4ce0c8b

Browse files
authored
Merge pull request #5355 from ruijin/scattkeep null in x,y so regl knows the end of polygonergl_fill_fix
2 parents 278950b + 4775030 commit 4ce0c8b

File tree

5 files changed

+33
-87
lines changed

5 files changed

+33
-87
lines changed

package-lock.json

+5-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"polybooljs": "^1.2.0",
111111
"regl": "^1.6.1",
112112
"regl-error2d": "^2.0.11",
113-
"regl-line2d": "^3.0.18",
113+
"regl-line2d": "^3.1.0",
114114
"regl-scatter2d": "^3.2.1",
115115
"regl-splom": "^1.0.12",
116116
"right-now": "^1.0.0",

src/traces/scattergl/plot.js

+4
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,14 @@ module.exports = function plot(gd, subplot, cdata) {
182182
} else if(trace.fill === 'toself' || trace.fill === 'tonext') {
183183
pos = [];
184184
last = 0;
185+
186+
fillOptions.splitNull = true;
187+
185188
for(j = 0; j < srcPos.length; j += 2) {
186189
if(isNaN(srcPos[j]) || isNaN(srcPos[j + 1])) {
187190
pos = pos.concat(srcPos.slice(last, j));
188191
pos.push(srcPos[last], srcPos[last + 1]);
192+
pos.push(null, null); // keep null to mark end of polygon
189193
last = j + 2;
190194
}
191195
}
Loading

test/image/mocks/gl2d_scatter_fill_self_next.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,29 @@
1717
"y": [5, 6, 5],
1818
"fill": "toself",
1919
"type": "scattergl"
20-
}
20+
},
21+
{
22+
"x": [1.1, 1.1, 2.1, null,
23+
-1.9,-1.9,-0.9,null,
24+
-4.9,-4.9,-3.9],
25+
"y": [6.1, 7.1, 7.1, null,
26+
1.1, 2.1, 2.1, null,
27+
1.1, 2.1, 2.1],
28+
"type": "scattergl",
29+
"fill": "tonext"
30+
},
31+
{
32+
"x": [ 0, 0, 2, 2, 0, null,
33+
1,1,3,3,1,null,
34+
-2,-2,0,0,-2,null,
35+
-5,-5,-3,-3,-5],
36+
"y": [9, 10, 10, 9, 9, null,
37+
6,8, 8, 6,6,null,
38+
1,3,3,1, 1,null,
39+
1,3,3,1,1],
40+
"type": "scattergl",
41+
"fill": "tonext"
42+
}
2143
],
2244
"layout":{
2345
"title": {"text": "Fill toself and tonext"},

0 commit comments

Comments
 (0)