Repository navigation
fix: optimize marker direction when metro router is relegated to fallbackRoute - #5029
Conversation
Summary of ChangesHello @GaoFuhong, 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! 此拉取请求解决了 Highlights
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
|
| it('should call manhattan with metro defaults', () => { | ||
| manhattanMock.mockReturnValue([]) | ||
|
|
||
| metro.call({} as any, [], {}, {} as any) |
There was a problem hiding this comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5029 +/- ##
==========================================
+ Coverage 83.24% 83.38% +0.13%
==========================================
Files 332 332
Lines 38453 38462 +9
Branches 7887 7893 +6
==========================================
+ Hits 32009 32070 +61
+ Misses 6421 6369 -52
Partials 23 23
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/gemini review |
| it('should call manhattan with metro defaults', () => { | ||
| manhattanMock.mockReturnValue([]) | ||
|
|
||
| metro.call({} as any, [], {}, {} as any) |
| const fallbackRoute = options.fallbackRoute as any | ||
|
|
||
| const resolvedOptions: any = { | ||
| directions: Array.from({ length: 8 }, () => ({})), | ||
| previousDirectionAngle: null, | ||
| } |
There was a problem hiding this comment.
在测试中过度使用 as any 会降低类型安全性,并可能掩盖潜在的类型相关错误。根据通用规则,应避免使用 as any。请为 fallbackRoute 和 resolvedOptions 提供更具体的类型,以提高测试的健壮性和可读性。
| const fallbackRoute = options.fallbackRoute as any | |
| const resolvedOptions: any = { | |
| directions: Array.from({ length: 8 }, () => ({})), | |
| previousDirectionAngle: null, | |
| } | |
| const fallbackRoute = options.fallbackRoute as ( | |
| from: Point, | |
| to: Point, | |
| options: { directions: any[]; previousDirectionAngle: number | null }, | |
| ) => Point[] | |
| const resolvedOptions = { | |
| directions: Array.from({ length: 8 }, () => ({})), | |
| previousDirectionAngle: null, | |
| } |
References
- Avoid using
as anyfor type casting; find the correct type definition instead to maintain type safety.
| return route | ||
| }, | ||
| function metroFallbackRoute( | ||
| this: any, |
…backRoute (#5029) * fix: optimize marker direction when metro router is relegated to fallbackRoute
📝 Description
问题:metro 路由在降级到 fallbackRoute 时,返回的路径点包含目标点本身,rounded 连接器在末端生成零长度段,导致 marker 的自动方向计算取用上一个有效切线,在近距离情况下方向可能与末端走向相反。
解法:修改 metro 路由的 fallbackRoute,仅返回中间拐点,不再返回目标点,避免末段重复点导致零长度段,确保箭头方向与末端切线一致。
🖼️ Screenshot
💡 Motivation and Context
🧩 Types of changes
🔍 Self Check before Merge