handle WebGL layers

This commit is contained in:
mike-000
2022-02-10 11:40:44 +00:00
committed by GitHub
parent 96de98bfbb
commit bf199bbe38

View File

@@ -917,15 +917,19 @@ function getImageData(layer, frameState) {
}
const container = renderer.renderFrame(frameState, null);
let element;
if (container) {
element = container.firstElementChild;
}
if (!(element instanceof HTMLCanvasElement)) {
throw new Error('Unsupported rendered element: ' + element);
}
if (element.width === width && element.height === height) {
const context = element.getContext('2d');
return context.getImageData(0, 0, width, height);
if (container instanceof HTMLCanvasElement) {
element = container;
} else {
if (container) {
element = container.firstElementChild;
}
if (!(element instanceof HTMLCanvasElement)) {
throw new Error('Unsupported rendered element: ' + element);
}
if (element.width === width && element.height === height) {
const context = element.getContext('2d');
return context.getImageData(0, 0, width, height);
}
}
if (!sharedContext) {