Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(play): stop the wardrobe panel vanishing when reopened mid-close animation
nirholasc8c67716ab03
diff --git a/scripts/play-souvenir-ui-check.mjs b/scripts/play-souvenir-ui-check.mjsindex 5d7188a38..3bcaa3942 100644--- a/scripts/play-souvenir-ui-check.mjs+++ b/scripts/play-souvenir-ui-check.mjs@@ -149,12 +149,20 @@ async function main() {}), [SOUVENIR_ID]);await sleep(700);+ // The poster is lazy-loaded; give it a beat rather than racing it.+ await page.waitForFunction(() => {+ const img = document.querySelector('.es-card .es-thumb img');+ return !img || (img.complete && img.naturalWidth > 0);+ }, null, { timeout: 15_000 }).catch(() => {});+const card = await page.evaluate(() => {const c = document.querySelector('.es-card');if (!c) return null;const img = c.querySelector('.es-thumb img');+ const r = c.getBoundingClientRect();return {- visible: !!c.offsetParent,+ // A fixed-position element has no offsetParent, so measure it instead.+ visible: r.width > 0 && r.height > 0 && getComputedStyle(c).visibility !== 'hidden',kicker: c.querySelector('.es-kicker')?.textContent.trim(),name: c.querySelector('.es-name')?.textContent,sub: c.querySelector('.es-sub')?.textContent,@@ -262,7 +270,7 @@ async function main() {await page.evaluate(() => {window.__wardrobe.close();window.__SHOP_OPENS__ = 0;- window.__wardrobe.setProfile({ owned: [], equipped: {} });+ window.__wardrobe.setProfile({ cosmetics: { owned: [], equipped: {} } });window.__wardrobe.open();});await sleep(700);diff --git a/src/game/cosmetics-wardrobe.js b/src/game/cosmetics-wardrobe.jsindex dd13d01ce..8b03cb554 100644--- a/src/game/cosmetics-wardrobe.js+++ b/src/game/cosmetics-wardrobe.js@@ -108,7 +108,13 @@ export class CosmeticsWardrobe {toggle() { this.isOpen() ? this.close() : this.open(); }open() {- if (this.isOpen()) return;+ // A close() still playing its exit animation has not set `hidden` yet, so+ // isOpen() reads true and this would early-return: the panel would look+ // open for 180ms and then vanish when the pending hide fired. Reopening+ // inside that window is a real path (dismiss the panel, then click "My+ // Fits" on a souvenir card), so cancel the hide and carry on re-opening.+ if (this._hideTimer) { clearTimeout(this._hideTimer); this._hideTimer = 0; }+ else if (this.isOpen()) return;this.root.hidden = false;requestAnimationFrame(() => this.root.classList.add('cw-in'));// Escape stack + Tab containment + focus restore, shared with every other@@ -138,10 +144,11 @@ export class CosmeticsWardrobe {this.root.classList.remove('cw-in');this._releaseModal?.();this._releaseModal = null;- setTimeout(() => { this.root.hidden = true; }, 180);+ this._hideTimer = setTimeout(() => { this._hideTimer = 0; this.root.hidden = true; }, 180);}dispose() {+ if (this._hideTimer) { clearTimeout(this._hideTimer); this._hideTimer = 0; }this._releaseModal?.();this._releaseModal = null;this.root.remove();