-
-
Notifications
You must be signed in to change notification settings - Fork 316
fix: resume alpha filter #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @HardyNLee, 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! 此拉取请求旨在通过恢复和优化 alpha 滤镜方案来解决多个与 PIXI.js 容器透明度相关的渲染问题。通过引入一个专用的 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. 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 恢复了 alphaFilter 方案来处理透明度,以解决 PIXI.Container 的 alpha 属性为 0 时导致渲染跳过和子节点更新停止的问题。这个改动方向是正确的,并且解决了相关 issue 中描述的滤镜顺序问题。
代码的整体改动是有效的,但在几个文件中使用了 @ts-ignore 和动态属性赋值,这会影响代码的类型安全和长期可维护性。我在具体的 review comments 中提供了一些建议,通过使用类型断言来改善这些问题,使代码更清晰和健壮。
| // 处理 alphaL | ||
| // @ts-ignore | ||
| segment['alphaFilterVal'] = segment.alpha; | ||
| segment.alpha = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通过 @ts-ignore 和字符串索引 segment['alphaFilterVal'] 来动态添加属性,会绕过 TypeScript 的类型检查,降低了代码的可读性和类型安全性。建议使用类型断言来代替,这样能更清晰地表达代码意图,也便于未来维护。
另外,第23行的注释 // 处理 alphaL 中存在一个拼写错误,应为 // 处理 alpha。
| // 处理 alphaL | |
| // @ts-ignore | |
| segment['alphaFilterVal'] = segment.alpha; | |
| segment.alpha = 1; | |
| // 处理 alpha | |
| // 通过类型断言来动态添加属性,避免使用 @ts-ignore | |
| (segment as any).alphaFilterVal = segment.alpha; | |
| segment.alpha = 1; |
| // @ts-ignore | ||
| newTransform['alphaFilterVal'] = effect.transform.alpha; | ||
| newTransform.alpha = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
与 timeline.ts 中的情况类似,这里使用 @ts-ignore 和字符串索引来动态添加 alphaFilterVal 属性,这会降低代码的类型安全性和可维护性。为了使代码更健壮和清晰,建议使用类型断言。
| // @ts-ignore | |
| newTransform['alphaFilterVal'] = effect.transform.alpha; | |
| newTransform.alpha = 1; | |
| // 通过类型断言来动态添加属性,避免使用 @ts-ignore | |
| (newTransform as any).alphaFilterVal = effect.transform.alpha; | |
| newTransform.alpha = 1; |
介绍
恢复 alphaFilterVal ,即之前的 alpha 滤镜方案。
您可能会注意到我没有恢复 setEffect 以前转化 alpha 的逻辑,因为我实际测试它反而会有点问题,只要保证 updateEffect 之前处理好应该就行。 我检查了所有 updateEffect ,应该是不会出问题的。
fix #829
fix #830
fix #831