Skip to content

Commit 24afe77

Browse files
committed
emit 'plotly_webglcontextlost' event on webgl context lost
- with event data containing the original event and the canvas 'key' to determine which canvas lost its context.
1 parent ff3c324 commit 24afe77

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/prepare_regl.js

+9
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ module.exports = function prepareRegl(gd, extensions) {
4848
} catch(e) {
4949
success = false;
5050
}
51+
52+
if(success) {
53+
this.addEventListener('webglcontextlost', function(event) {
54+
gd.emit('plotly_webglcontextlost', {
55+
event: event,
56+
layer: d.key
57+
});
58+
}, false);
59+
}
5160
});
5261

5362
if(!success) {

0 commit comments

Comments
 (0)