fix: set crossOrigin on new Image() loads in assets.js and guide.js

When /assets/ is served from a separate origin (CDN/object storage),
images loaded via new Image() are not CORS-approved, tainting canvases
and breaking WebGL textures (empty map, white 3D board).
This commit is contained in:
T1ipoca committed 2026-10-03 12:01:39 +08:00
1 parent 7f134737ce
commit 15cceeb63a
2 files changed
+2

No files matched your search

+1
View File
@@ -417,6 +417,7 @@ export function loadImageElement(url) {
if (typeof Image === 'undefined') { reject(new Error('no Image in this environment')); return; }
const img = new Image();
img.decoding = 'async';
img.crossOrigin = 'anonymous';
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`image failed: ${url}`));
img.src = url;
+1
View File
@@ -67,6 +67,7 @@ function preload(url) {
if (!url || typeof Image === 'undefined') return;
const img = new Image();
img.decoding = 'async';
img.crossOrigin = 'anonymous';
img.src = url;
}