From d0da4b0722178aeb9734a2a2c9835f7366022413 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Fri, 2 Oct 2026 15:04:35 -0700 Subject: [PATCH] Keep the panel's 2D canvases in memory In Claude, the app's 2D overlay canvases covered the globe in black while the host treated the panel as off screen, and the globe showed once they were hidden. The panel now asks for 2D canvases backed by memory rather than the GPU. --- src/app/globePanelRuntime.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/globePanelRuntime.js b/src/app/globePanelRuntime.js index 879630c19..2e38d63dd 100644 --- a/src/app/globePanelRuntime.js +++ b/src/app/globePanelRuntime.js @@ -341,6 +341,16 @@ export function panelRuntime(config) { }; window.Worker.prototype = NativeWorker.prototype; + // Some hosts drop the GPU contents of a panel's 2D canvases while they + // consider the panel off screen, and the overlays then cover the globe + // in black. Keep 2D canvases in memory instead, which hosts do not drop. + const getContext = HTMLCanvasElement.prototype.getContext; + HTMLCanvasElement.prototype.getContext = function (type, options) { + return type === '2d' + ? getContext.call(this, type, { ...options, willReadFrequently: true }) + : getContext.call(this, type, options); + }; + // Markup the app adds as HTML text would request its images from this // page's site at once; hold their addresses until the files are here. const htmlWithHeldImages = (html) =>