File tree 2 files changed +34
-3
lines changed
2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -3265,9 +3265,6 @@ function makePlotFramework(gd) {
3265
3265
fullLayout . _glcontainer . enter ( ) . append ( 'div' )
3266
3266
. classed ( 'gl-container' , true ) ;
3267
3267
3268
- // That is initialized in drawFramework if there are `gl` traces
3269
- fullLayout . _glcanvas = null ;
3270
-
3271
3268
fullLayout . _paperdiv . selectAll ( '.main-svg' ) . remove ( ) ;
3272
3269
3273
3270
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() {
1033
1033
. catch ( failTest )
1034
1034
. then ( done ) ;
1035
1035
} ) ;
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
+ } ) ;
1036
1070
} ) ;
1037
1071
1038
1072
describe ( 'Test scattergl autorange:' , function ( ) {
You can’t perform that action at this time.
0 commit comments