File tree 2 files changed +14
-0
lines changed
packages/javascript/jupyterlab-plotly/src
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,16 @@ export class RenderedPlotly extends Widget implements IRenderMime.IRenderer {
148
148
}
149
149
} ) ;
150
150
}
151
+
152
+
153
+ ( < Plotly . PlotlyHTMLElement > ( this . node ) ) . on ( 'plotly_webglcontextlost' , ( ) => {
154
+ const png_data = < string > model . data [ 'image/png' ] ;
155
+ if ( png_data !== undefined && png_data !== null ) {
156
+ // We have PNG data, use it
157
+ this . createImage ( png_data ) ;
158
+ return Promise . resolve ( ) ;
159
+ }
160
+ } ) ;
151
161
} ) ;
152
162
}
153
163
Original file line number Diff line number Diff line change @@ -3,4 +3,8 @@ declare module 'plotly.js/dist/plotly' {
3
3
export type Frame = { [ key : string ] : any } ;
4
4
export function addFrames ( root : Plotly . Root , frames : Frame [ ] ) : Promise < void > ;
5
5
export function animate ( root : Plotly . Root ) : void ;
6
+
7
+ export interface PlotlyHTMLElement extends HTMLElement {
8
+ on ( event : 'plotly_webglcontextlost' , callback : ( ) => void ) : void ;
9
+ }
6
10
}
You can’t perform that action at this time.
0 commit comments