feat(profile-editor): 为时间表编辑器添加撤销/重做功能#1818
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f60b6cd32
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
涉及文件:
|
6ed1df6 to
b457db9
Compare
HelloWRC
left a comment
There was a problem hiding this comment.
此外,目前还发现了以下问题:
- 在刚刚创建完新时间点时,Ctrl + Z 键盘快捷键无法撤销,而只有在将选择移动到其它时间点后,才可以撤销。
- 并且在通过键盘快捷键 Ctrl + Z 撤销删除了选中的时间点后,无法继续使用 Ctrl + Z 撤销,只有在选中了其他时间点后,才能继续使用此快捷键撤销。
| private readonly Stack<UndoEntry> _undoStack = new(); | ||
| private readonly Stack<UndoEntry> _redoStack = new(); | ||
|
|
||
| private static string DescribeItem(TimeLayoutItem item) => item.TimeType switch |
There was a problem hiding this comment.
TimeLayoutItem 的 ToString 方法已经实现了将 TimeLayoutItem 转换为描述性的字符串,无需在此处进行额外的封装。
There was a problem hiding this comment.
已经删掉 DescribeItem,直接用 item.ToString() 了,感谢指出
| ToolTip.Tip="添加行动时间点。" | ||
| Label="行动" /> | ||
| <controls:CommandBarSeparator /> | ||
| <controls:CommandBarButton IconSource="{ci:FluentIconSource }" |
There was a problem hiding this comment.
已经去掉按钮的文字标签改成纯图标,命令栏不会再溢出了,图标也换成了 arrow_undo / arrow_redo,符合撤销/重做语义
b457db9 to
36eb955
Compare
|
这两个都修了,把 Ctrl+Z/Y 改成了窗口级快捷键,不再依赖时间点列表是否获得焦点,所以新建时间点或撤销删除后都能直接继续用,同时做了保护,焦点在文本框里时仍走文本框自己的撤销 |
|
感谢您的贡献🤝 @all-contributors please add @Akiyama-Mizuki-44 for code |
|
I've put up a pull request to add @Akiyama-Mizuki-44! 🎉 |
* feat(profile-editor): 添加时间点撤销功能 (Ctrl+Z) * feat(profile-editor): 添加时间点重做功能 (Ctrl+Y) * feat(profile-editor): 撤销/重做支持历史记录下拉列表 * fix(profile-editor): 修复时间表为空时 Ctrl+Z/Y 快捷键失效的问题 * fix(profile-editor): 撤销/重做后同步更新选中的时间点 * style: 移除重复的 break 语句与多余空行 * fix(profile-editor): 撤销/重做改用窗口级快捷键,修复新建或撤销后需重新选中才能触发的问题 * fix(profile-editor): 使用 item.ToString() 替代 DescribeItem,改用正确图标并移除按钮文字标签 --------- Co-authored-by: 曉山瑞希🍥🏳️⚧️ <w_mutsumi@hotmail.com>


这个 Pull Request 做了什么?
为时间表编辑器添加撤销(Ctrl+Z)和重做(Ctrl+Y)功能:
检查清单