@@ -323,6 +323,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
323
323
324
324
Drawing . setClipUrl ( lineJoin , plotinfo . layerClipId ) ;
325
325
326
+ function clearFill ( selection ) {
327
+ transition ( selection ) . attr ( 'd' , 'M0,0Z' ) ;
328
+ }
329
+
326
330
if ( segments . length ) {
327
331
if ( ownFillEl3 ) {
328
332
if ( pt0 && pt1 ) {
@@ -348,30 +352,41 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
348
352
}
349
353
}
350
354
}
351
- else if ( trace . fill . substr ( 0 , 6 ) === 'tonext' && fullpath && prevRevpath ) {
352
- // fill to next: full trace path, plus the previous path reversed
353
- if ( trace . fill === 'tonext' ) {
354
- // tonext: for use by concentric shapes, like manually constructed
355
- // contours, we just add the two paths closed on themselves.
356
- // This makes strange results if one path is *not* entirely
357
- // inside the other, but then that is a strange usage.
358
- transition ( tonext ) . attr ( 'd' , fullpath + 'Z' + prevRevpath + 'Z' )
359
- . call ( Drawing . singleFillStyle ) ;
355
+ else if ( tonext ) {
356
+ if ( trace . fill . substr ( 0 , 6 ) === 'tonext' && fullpath && prevRevpath ) {
357
+ // fill to next: full trace path, plus the previous path reversed
358
+ if ( trace . fill === 'tonext' ) {
359
+ // tonext: for use by concentric shapes, like manually constructed
360
+ // contours, we just add the two paths closed on themselves.
361
+ // This makes strange results if one path is *not* entirely
362
+ // inside the other, but then that is a strange usage.
363
+ transition ( tonext ) . attr ( 'd' , fullpath + 'Z' + prevRevpath + 'Z' )
364
+ . call ( Drawing . singleFillStyle ) ;
365
+ }
366
+ else {
367
+ // tonextx/y: for now just connect endpoints with lines. This is
368
+ // the correct behavior if the endpoints are at the same value of
369
+ // y/x, but if they *aren't*, we should ideally do more complicated
370
+ // things depending on whether the new endpoint projects onto the
371
+ // existing curve or off the end of it
372
+ transition ( tonext ) . attr ( 'd' , fullpath + 'L' + prevRevpath . substr ( 1 ) + 'Z' )
373
+ . call ( Drawing . singleFillStyle ) ;
374
+ }
375
+ trace . _polygons = trace . _polygons . concat ( prevPolygons ) ;
360
376
}
361
377
else {
362
- // tonextx/y: for now just connect endpoints with lines. This is
363
- // the correct behavior if the endpoints are at the same value of
364
- // y/x, but if they *aren't*, we should ideally do more complicated
365
- // things depending on whether the new endpoint projects onto the
366
- // existing curve or off the end of it
367
- transition ( tonext ) . attr ( 'd' , fullpath + 'L' + prevRevpath . substr ( 1 ) + 'Z' )
368
- . call ( Drawing . singleFillStyle ) ;
378
+ clearFill ( tonext ) ;
379
+ trace . _polygons = null ;
369
380
}
370
- trace . _polygons = trace . _polygons . concat ( prevPolygons ) ;
371
381
}
372
382
trace . _prevRevpath = revpath ;
373
383
trace . _prevPolygons = thisPolygons ;
374
384
}
385
+ else {
386
+ if ( ownFillEl3 ) clearFill ( ownFillEl3 ) ;
387
+ else if ( tonext ) clearFill ( tonext ) ;
388
+ trace . _polygons = trace . _prevRevpath = trace . _prevPolygons = null ;
389
+ }
375
390
376
391
377
392
function visFilter ( d ) {
0 commit comments