File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -3243,9 +3243,6 @@ function makePlotFramework(gd) {
32433243 fullLayout . _glcontainer . enter ( ) . append ( 'div' )
32443244 . classed ( 'gl-container' , true ) ;
32453245
3246- // That is initialized in drawFramework if there are `gl` traces
3247- fullLayout . _glcanvas = null ;
3248-
32493246 fullLayout . _paperdiv . selectAll ( '.main-svg' ) . remove ( ) ;
32503247
32513248 fullLayout . _paper = fullLayout . _paperdiv . insert ( 'svg' , ':first-child' )
Original file line number Diff line number Diff line change @@ -1033,6 +1033,40 @@ describe('@gl Test gl2d plots', function() {
10331033 . catch ( failTest )
10341034 . then ( done ) ;
10351035 } ) ;
1036+
1037+ it ( '@gl should clear canvases on *replot* edits' , function ( done ) {
1038+ Plotly . plot ( gd , [ {
1039+ type : 'scattergl' ,
1040+ y : [ 1 , 2 , 1 ]
1041+ } , {
1042+ type : 'scattergl' ,
1043+ y : [ 2 , 1 , 2 ]
1044+ } ] )
1045+ . then ( function ( ) {
1046+ expect ( gd . _fullLayout . _glcanvas ) . toBeDefined ( ) ;
1047+ expect ( gd . _fullLayout . _glcanvas . size ( ) ) . toBe ( 3 ) ;
1048+
1049+ expect ( gd . _fullLayout . _glcanvas . data ( ) [ 0 ] . regl ) . toBeDefined ( ) ;
1050+ expect ( gd . _fullLayout . _glcanvas . data ( ) [ 1 ] . regl ) . toBeDefined ( ) ;
1051+ // this is canvas is for parcoords only
1052+ expect ( gd . _fullLayout . _glcanvas . data ( ) [ 2 ] . regl ) . toBeUndefined ( ) ;
1053+
1054+ spyOn ( gd . _fullLayout . _glcanvas . data ( ) [ 0 ] . regl , 'clear' ) . and . callThrough ( ) ;
1055+ spyOn ( gd . _fullLayout . _glcanvas . data ( ) [ 1 ] . regl , 'clear' ) . and . callThrough ( ) ;
1056+
1057+ return Plotly . update ( gd ,
1058+ { visible : [ false ] } ,
1059+ { 'xaxis.title' : 'Tsdads' , 'yaxis.ditck' : 0.2 } ,
1060+ [ 0 ]
1061+ ) ;
1062+ } )
1063+ . then ( function ( ) {
1064+ expect ( gd . _fullLayout . _glcanvas . data ( ) [ 0 ] . regl . clear ) . toHaveBeenCalledTimes ( 1 ) ;
1065+ expect ( gd . _fullLayout . _glcanvas . data ( ) [ 1 ] . regl . clear ) . toHaveBeenCalledTimes ( 1 ) ;
1066+ } )
1067+ . catch ( failTest )
1068+ . then ( done ) ;
1069+ } ) ;
10361070} ) ;
10371071
10381072describe ( 'Test scattergl autorange:' , function ( ) {
You can’t perform that action at this time.
0 commit comments