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
+4
View File
@@ -917,6 +917,9 @@ function getImageData(layer, frameState) {
} }
const container = renderer.renderFrame(frameState, null); const container = renderer.renderFrame(frameState, null);
let element; let element;
if (container instanceof HTMLCanvasElement) {
element = container;
} else {
if (container) { if (container) {
element = container.firstElementChild; element = container.firstElementChild;
} }
@@ -927,6 +930,7 @@ function getImageData(layer, frameState) {
const context = element.getContext('2d'); const context = element.getContext('2d');
return context.getImageData(0, 0, width, height); return context.getImageData(0, 0, width, height);
} }
}
if (!sharedContext) { if (!sharedContext) {
sharedContext = createCanvasContext2D(width, height); sharedContext = createCanvasContext2D(width, height);