diff --git a/docs/progress.md b/docs/progress.md index 0a8ba42..3515789 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -207,3 +207,10 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo - Added a validated pet manifest and mapped the source animation rows into idle, thinking, speaking, notification, error, and offline states. - Replaced the CSS placeholder character in the floating pet view with the real pixel spritesheet renderer. - Validation: Rust workspace tests (65), Clippy, TypeScript, ESLint, Vitest (6), and Vite build pass. + +## 2026-07-20: production pet renderer white-window fix + +- Replaced the floating pet CSS background-image crop with a clipped `` spritesheet renderer for more reliable WebView2/asset-protocol loading. +- Added explicit pet-view root sizing and transparent `html`/`body`/`#root` backgrounds so Tauri transparent windows do not fall back to an opaque blank surface. +- Validation: TypeScript, ESLint, Vitest (6), Vite build, Rust format, Clippy with warnings denied, Rust workspace tests (66), and NSIS bundle build pass. +- The already-running executable must be fully closed and relaunched; the generated installer is at `target/release/bundle/nsis/AstrBot Desktop_0.1.0-alpha.1_x64-setup.exe`. diff --git a/src/App.tsx b/src/App.tsx index bdc3b03..cf4b0e6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -405,6 +405,11 @@ function DesktopPetView() { const [state, setState] = useState<"idle" | "working" | "resting" | "speaking" | "error">("idle"); const [frameIndex, setFrameIndex] = useState(0); + useEffect(() => { + document.documentElement.classList.add("pet-view"); + return () => document.documentElement.classList.remove("pet-view"); + }, []); + useEffect(() => { let cancelled = false; const refreshPetState = async () => { @@ -465,14 +470,20 @@ function DesktopPetView() { ×
+ > + +
{state === "working" ? "正在写写画画" : state === "resting" ? "休息中" : state === "speaking" ? "正在回应" : state === "error" ? "需要重新登录或检查连接" : "陪伴中"} ); diff --git a/src/styles.css b/src/styles.css index 1545ad2..99b2de7 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1135,7 +1135,7 @@ select:focus { .chat-session small { color: #91a7c9; font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .warning-banner { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; } -.pet-window { position: relative; display: grid; min-height: 100vh; place-items: center; overflow: hidden; color: #f7faff; background: transparent; user-select: none; } +.pet-window { position: relative; display: grid; width: 100%; height: 100%; min-height: 0; place-items: center; overflow: hidden; color: #f7faff; background: transparent; user-select: none; } .pet-window-close { position: absolute; top: .5rem; right: .5rem; z-index: 2; width: 1.8rem; height: 1.8rem; padding: 0; border: 1px solid rgb(255 255 255 / 25%); border-radius: 999px; color: #fff; background: rgb(8 17 31 / 72%); line-height: 1; } .pet-window-status { position: absolute; right: 0; bottom: .35rem; left: 0; color: #d7e5ff; font-size: .72rem; text-align: center; text-shadow: 0 1px 4px #08111f; } .paper-pet { position: relative; width: 128px; height: 168px; animation: pet-idle 2.4s ease-in-out infinite; } @@ -1159,16 +1159,36 @@ select:focus { @keyframes pet-rest { 50% { transform: translateY(8px) rotate(8deg); } } @keyframes pet-error { from { transform: translateX(-3px); } to { transform: translateX(3px); } } -.aemeath-pet-sprite { +.pet-view, +.pet-view body, +.pet-view #root { + width: 100%; + height: 100%; + min-width: 0; + min-height: 0; + background: transparent !important; +} + +.aemeath-pet-frame { + position: relative; width: 192px; height: 208px; - background-repeat: no-repeat; - background-size: 1536px 3120px; - image-rendering: pixelated; + overflow: hidden; transform: scale(.78); transform-origin: center; } +.aemeath-pet-sprite { + position: absolute; + top: 0; + left: 0; + width: 1536px; + height: 3120px; + max-width: none; + image-rendering: pixelated; + user-select: none; +} + .aemeath-pet-working { filter: drop-shadow(0 0 8px rgb(115 190 255 / 45%)); } .aemeath-pet-speaking { filter: drop-shadow(0 0 8px rgb(255 207 125 / 45%)); } .aemeath-pet-error { filter: drop-shadow(0 0 8px rgb(255 105 130 / 60%)); }