Files
claude-pet/package.json
T
JianMiauandClaude Fable 5 bf059b19cf 點穿改由主程序決定並加入滑鼠診斷:修不能拖曳、不能右鍵
根本原因:
點穿狀態一直是 renderer 判定後再用 IPC 叫主程序切換。renderer 只要例外、
卡住或狀態錯亂(例如視窗永遠不取得焦點、Windows 對背景視窗的 capture 有限制,
放開的那一下落在視窗外就收不到 mouseup,pressed 從此卡在 true),主程序就
再也收不到切換指令,寵物永遠點不到。另外 2.0.8 起每 2 秒的置頂重宣告會在
右鍵選單開著時把寵物視窗抬到選單上面,2.0.10 改成整個方框接滑鼠後,被蓋住
的選單項目就點不到了。

影響:
偶發「不能拖曳、不能右鍵」,而且發生時沒有任何可查的狀態或紀錄。

修法:
1. 主程序每 50 ms 自己輪詢游標,對照 renderer 回報的人物方框與氣泡矩形
   (pet:hit-rects)直接呼叫 setIgnoreMouseEvents;決策邏輯抽成 lib/hit-test.js。
   renderer 沒回報或掛掉時用版面公式算方框當備援,並自動重載。
2. 拖曳不管因 mouseup、逾時(20 秒)或其他原因結束,都送 pet:drag-ended
   讓 renderer 清掉按住/拖曳狀態。
3. 右鍵選單開著時暫停置頂重宣告。
4. /state 回傳 bounds 與 mouse 診斷(是否點穿、游標相對座標、是否在方框/
   氣泡、矩形來源、切換與輪詢次數、renderer 錯誤、拖曳結束原因);renderer
   例外、拖曳開始/結束、選單開關寫入事件紀錄。
版號 2.0.11。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 14:15:29 +08:00

91 lines
2.3 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.11",
"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",
"release": "node scripts/release.js",
"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"
}
]
}
}