mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
[Plot] Fall back from WebGL on context loss
When a WebGL context is loss, fall back to displaying plots using regular canvas 2d API. WTD-475.
This commit is contained in:
parent
dac44623ee
commit
b6fdf4d6ab
@ -155,6 +155,7 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
// Switch from WebGL to plain 2D if context is lost
|
||||
function fallbackFromWebGL() {
|
||||
element.html(TEMPLATE);
|
||||
canvas = element.find("canvas")[0];
|
||||
@ -173,6 +174,11 @@ define(
|
||||
return;
|
||||
}
|
||||
|
||||
// WebGL is a bit of a special case; it may work, then fail
|
||||
// later for various reasons, so we need to listen for this
|
||||
// and fall back to plain canvas drawing when it occurs.
|
||||
canvas.addEventListener("webglcontextlost", fallbackFromWebGL);
|
||||
|
||||
// Check for resize, on a timer
|
||||
activeInterval = $interval(drawIfResized, 1000);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user