From 15cceeb63adac2caf0172c5f9d7e1a7e8472219e Mon Sep 17 00:00:00 2001 From: T1ipoca Date: Sat, 3 Oct 2026 12:01:39 +0800 Subject: [PATCH] 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). --- public/js/assets.js | 1 + public/js/ui/guide.js | 1 + 2 files changed, 2 insertions(+) diff --git a/public/js/assets.js b/public/js/assets.js index 7992df36..824ab58e 100644 --- a/public/js/assets.js +++ b/public/js/assets.js @@ -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; diff --git a/public/js/ui/guide.js b/public/js/ui/guide.js index eca03ba4..e1f3343d 100644 --- a/public/js/ui/guide.js +++ b/public/js/ui/guide.js @@ -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; }