handle WebGL layers
This commit is contained in:
+13
-9
@@ -917,15 +917,19 @@ function getImageData(layer, frameState) {
|
|||||||
}
|
}
|
||||||
const container = renderer.renderFrame(frameState, null);
|
const container = renderer.renderFrame(frameState, null);
|
||||||
let element;
|
let element;
|
||||||
if (container) {
|
if (container instanceof HTMLCanvasElement) {
|
||||||
element = container.firstElementChild;
|
element = container;
|
||||||
}
|
} else {
|
||||||
if (!(element instanceof HTMLCanvasElement)) {
|
if (container) {
|
||||||
throw new Error('Unsupported rendered element: ' + element);
|
element = container.firstElementChild;
|
||||||
}
|
}
|
||||||
if (element.width === width && element.height === height) {
|
if (!(element instanceof HTMLCanvasElement)) {
|
||||||
const context = element.getContext('2d');
|
throw new Error('Unsupported rendered element: ' + element);
|
||||||
return context.getImageData(0, 0, width, height);
|
}
|
||||||
|
if (element.width === width && element.height === height) {
|
||||||
|
const context = element.getContext('2d');
|
||||||
|
return context.getImageData(0, 0, width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sharedContext) {
|
if (!sharedContext) {
|
||||||
|
|||||||
Reference in New Issue
Block a user