feat(Signature): add undo functionality#13775
Conversation
Summary of ChangesHello @wjw-gavin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Signature component by integrating a robust undo functionality. Users can now easily correct drawing mistakes, improving the overall usability and flexibility of the component. The changes include comprehensive internationalization for the new 'undo' text, updated documentation, and a well-tested implementation, ensuring a seamless and accessible experience for a global user base. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| const saveState = () => { | ||
| if (ctx.value && canvasWidth && canvasHeight) { | ||
| history.value.push( | ||
| ctx.value.getImageData(0, 0, canvasWidth, canvasHeight), | ||
| ); | ||
| } | ||
| }; |
There was a problem hiding this comment.
每次笔划都存储整个画布的 ImageData 可能会消耗大量内存,尤其是在高分辨率设备上或用户绘制了许多笔划的情况下。这可能会在低内存设备上导致性能问题或崩溃。比较好的做法是限制撤销历史记录的大小。您也可以考虑将此限制作为一个可配置的 prop。
例如:
const MAX_HISTORY_SIZE = 20; // 或者可以是一个 prop
const saveState = () => {
if (ctx.value && canvasWidth && canvasHeight) {
if (history.value.length >= MAX_HISTORY_SIZE) {
history.value.shift();
}
history.value.push(
ctx.value.getImageData(0, 0, canvasWidth, canvasHeight),
);
}
};| }); | ||
|
|
||
| expect(wrapper.find('.van-signature__footer').text()).toContain('Back'); | ||
| }); |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13775 +/- ##
==========================================
+ Coverage 89.60% 90.00% +0.40%
==========================================
Files 257 257
Lines 7013 7074 +61
Branches 1736 1755 +19
==========================================
+ Hits 6284 6367 +83
+ Misses 384 369 -15
+ Partials 345 338 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
close: #13633