feat: support tray icon spritesheets#15
Draft
wangrongding wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
electron/tray-list.ts中新增 spritesheet 支持:查找pet.json/tray-icon.json/sprite.jsonmanifest、解析配置、按 manifest 或默认网格(默认 8×9)计算格子并用nativeImage.crop()生成每帧NativeImage。getTrayIconSetsFromDirectory中优先返回精灵图集(否则回退到原有多文件帧逻辑)。importTrayIconSet中加入单张精灵图导入辅助:当只选择一张图且尺寸符合默认网格时会复制图片并生成本地pet.json(方便用户直接导入整张精灵图)。src/pages/Setting/TrayIconPanel.tsx中展示精灵图信息并增加预览:若为精灵图则用background-image+background-position/background-size做 CSS 定位预览,保留原有切割帧的<img>预览路径和交互。Testing
pnpm build:electron && pnpm build:web,两端构建均成功。pnpm lint,通过(仓库已有若干 warnings,但无新增错误)。Codex Task