Files
claude-pet/package.json
T
JianMiauandClaude Fable 5 d78f99fcc7 游標離開人物時立刻中斷跳躍,不再播完三次
摘要:
hover 跳躍改為「游標一離開就停」,而不是不管游標在哪都把 3 次播完。

根本原因:
把 hover 跳躍實作成一次性 overlay,播放長度固定為 STATE_REPEATS 輪,
setHovered(false) 只更新 hovered 旗標、不動 overlay,所以游標即使馬上移開,
跳躍仍會自顧自播完約 2.5 秒才回到基礎狀態。
這其實也偏離 Codex:Codex 的顯示狀態是 `hovered ? "jumping" : state`,
游標一離開就翻回原狀態並重跑動畫,本來就不會把跳躍播完。

影響:
只是游標經過或很快移開時,寵物還會繼續跳完,反應顯得遲滯、不跟手。

修法:
- play() 之後把該 overlay 標記 fromHover。
- setHovered(false) 時若目前 overlay 是 hover 觸發的就直接清掉,
  下一個 tick 會依 resolveAnim 回到當下的基礎狀態。
  只清 fromHover 的,初次問候揮手等其他一次性動作不受影響。
- README 的日常使用、行為對照表、與 Codex 的對照三處同步更新,
  對照表新增「hover 離開」一列。

保持不變:
進入時最多跳 3 次、游標持續停留不重複觸發(使用者已確認要這個行為)。

驗證:
以 DOM stub 載入完整 renderer.js 執行 13 項測試全過,涵蓋:
進入觸發 jumping 且序列為 15 幀、標記 fromHover、離開後 overlay 立刻為 null、
resolveAnim 立刻回 idle、工作中離開回到 running 而非 idle、
問候揮手不會被離開中斷、既有 overlay 期間不觸發跳躍、
持續停留不重複觸發、拖曳中不觸發。
另以 ELECTRON_RUN_AS_NODE 讀打包後 app.asar 確認版本 2.0.3 與六項改動都在出貨檔案裡,
exe FileVersion 為 2.0.3。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 16:58:57 +08:00

90 lines
2.2 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "claude-pet",
"version": "2.0.3",
"description": "Codex Pets 相容的 Claude Code 桌面寵物(spriteVersionNumber 29 個動作列 + 16 方向追視)",
"main": "main.js",
"private": true,
"scripts": {
"start": "electron .",
"hooks:install": "node scripts/install-hooks.js",
"hooks:uninstall": "node scripts/uninstall-hooks.js",
"autostart:install": "node scripts/autostart.js install",
"autostart:uninstall": "node scripts/autostart.js uninstall",
"autostart:status": "node scripts/autostart.js status",
"predist": "npm version patch --no-git-tag-version",
"dist": "electron-builder --win",
"pack": "electron-builder --win --dir",
"predist:portable": "npm version patch --no-git-tag-version",
"dist:portable": "electron-builder --win portable"
},
"devDependencies": {
"electron": "^43.4.1",
"electron-builder": "^26.0.12"
},
"author": "JianMiau",
"build": {
"appId": "com.jianmiau.claude-pet",
"productName": "Claude Pet",
"copyright": "JianMiau",
"directories": {
"output": "dist",
"buildResources": "build"
},
"files": [
"main.js",
"preload.js",
"renderer/**/*",
"lib/**/*",
"hook/**/*",
"package.json"
],
"asarUnpack": [
"hook/**/*"
],
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
},
{
"target": "portable",
"arch": [
"x64"
]
},
{
"target": "zip",
"arch": [
"x64"
]
}
],
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "Claude Pet",
"deleteAppDataOnUninstall": false,
"artifactName": "${productName}-${version}-setup.${ext}"
},
"portable": {
"artifactName": "${productName}-${version}-portable.${ext}",
"unpackDirName": "ClaudePet",
"requestExecutionLevel": "user"
},
"extraFiles": [
{
"from": "pets",
"to": "pets"
}
]
}
}