fix(WithdrawMoney): 修复快速连续点击导致异常滑动#278
Merged
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's Guide优化 WithdrawMoney 条目选择逻辑,以避免在快速点击时出现非预期滑动;将向上/向下条目的识别逻辑分离;简化数值聚合逻辑;并为点击行为增加日志记录,同时更新相关的 pipeline JSON 配置。 WithdrawMoney 中 click_rect 更新后点击处理的时序图sequenceDiagram
actor User
participant WithdrawMoneyChooseItem as WithdrawMoneyChooseItem
participant controller as Controller
User ->> WithdrawMoneyChooseItem: select_item
WithdrawMoneyChooseItem ->> controller: post_touch_move(cx, cy)
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> controller: post_touch_down(cx, cy)
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
WithdrawMoneyChooseItem ->> controller: post_touch_up()
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
WithdrawMoneyChooseItem ->> logger: debug(click value rect item_swipe)
WithdrawMoney 中更新后向上/向下条目选择流程图flowchart TD
A[Start WithdrawMoneyChooseItem] --> B[click_all_grey_backgrounds]
B --> C[time_sleep_1]
C --> D[collect_product_values WithdrawMoneyItemValueDown]
D --> E["down_items = (value, rect, down)"]
E --> F[run_act WithdrawMoneySwipeUp]
F --> G[time_sleep_0_1]
G --> H[collect_product_values WithdrawMoneyItemValueUp]
H --> I["up_items = (value, rect, up)"]
I --> J["all_items = down_items + up_items"]
J --> K["sorted_items = sorted_by_value_desc"]
K --> L["top5 = first_5"]
L --> M["for each (value, rect, item_swipe) in top5"]
M --> N{item_swipe != current_swipe}
N -- Yes --> O[run_act WithdrawMoneySwipeUp_or_Down]
O --> P[time_sleep_1]
N -- No --> P
P --> Q[_click_rect rect]
Q --> R[logger debug]
R --> S[time_sleep_0_5]
S --> T[End]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideRefines the WithdrawMoney item selection logic to avoid unintended swipes on rapid taps, separates up/down item recognition, simplifies value aggregation, and adds logging for tap actions, with associated pipeline JSON updates. Sequence diagram for updated tap handling in WithdrawMoney click_rectsequenceDiagram
actor User
participant WithdrawMoneyChooseItem as WithdrawMoneyChooseItem
participant controller as Controller
User ->> WithdrawMoneyChooseItem: select_item
WithdrawMoneyChooseItem ->> controller: post_touch_move(cx, cy)
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> controller: post_touch_down(cx, cy)
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
WithdrawMoneyChooseItem ->> controller: post_touch_up()
controller -->> WithdrawMoneyChooseItem: wait()
WithdrawMoneyChooseItem ->> WithdrawMoneyChooseItem: time_sleep_0_05
WithdrawMoneyChooseItem ->> logger: debug(click value rect item_swipe)
Flow diagram for updated up/down item selection in WithdrawMoneyflowchart TD
A[Start WithdrawMoneyChooseItem] --> B[click_all_grey_backgrounds]
B --> C[time_sleep_1]
C --> D[collect_product_values WithdrawMoneyItemValueDown]
D --> E["down_items = (value, rect, down)"]
E --> F[run_act WithdrawMoneySwipeUp]
F --> G[time_sleep_0_1]
G --> H[collect_product_values WithdrawMoneyItemValueUp]
H --> I["up_items = (value, rect, up)"]
I --> J["all_items = down_items + up_items"]
J --> K["sorted_items = sorted_by_value_desc"]
K --> L["top5 = first_5"]
L --> M["for each (value, rect, item_swipe) in top5"]
M --> N{item_swipe != current_swipe}
N -- Yes --> O[run_act WithdrawMoneySwipeUp_or_Down]
O --> P[time_sleep_1]
N -- No --> P
P --> Q[_click_rect rect]
Q --> R[logger debug]
R --> S[time_sleep_0_5]
S --> T[End]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出一些总体反馈:
- 从基于值去重改成简单地拼接
down_items和up_items之后,具有相同数值但位置不同的同一条目现在可能会被点击两次;如果这不是预期行为,建议在排序之前重新引入一个基于位置或数值的去重步骤。 WithdrawMoneySwipeUp之后的 0.1 秒 sleep 对于 UI 动画来说看起来有点紧;如果需要兼容多种设备或帧率,可能值得把这个延迟做成可配置,或者稍微加长一些,以避免间歇性的识别问题。_click_rect中新增的时间常量(两个 0.05 秒的 sleep)目前属于“魔法数字”;可以考虑把它们提取成具名常量,或者加一条简短注释说明这些数值是如何选取的,以便日后更容易调优。
面向 AI 代理的提示
Please address the comments from this code review:
## Overall Comments
- 从基于值去重改成简单地拼接 `down_items` 和 `up_items` 之后,具有相同数值但位置不同的同一条目现在可能会被点击两次;如果这不是预期行为,建议在排序之前重新引入一个基于位置或数值的去重步骤。
- `WithdrawMoneySwipeUp` 之后的 0.1 秒 sleep 对于 UI 动画来说看起来有点紧;如果需要兼容多种设备或帧率,可能值得把这个延迟做成可配置,或者稍微加长一些,以避免间歇性的识别问题。
- `_click_rect` 中新增的时间常量(两个 0.05 秒的 sleep)目前属于“魔法数字”;可以考虑把它们提取成具名常量,或者加一条简短注释说明这些数值是如何选取的,以便日后更容易调优。帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据这些反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- By switching from value-based de-duplication to simply concatenating
down_itemsandup_items, the same item with identical value and different positions may now be clicked twice; if that’s unintended, consider reintroducing a positional or value-based de-duplication step before sorting. - The 0.1-second sleep after
WithdrawMoneySwipeUplooks quite tight for UI animations; if you’re targeting a variety of devices or frame rates, it may be worth making this delay configurable or slightly longer to avoid intermittent recognition issues. - The new timing constants in
_click_rect(two 0.05-second sleeps) are currently “magic numbers”; consider extracting them into named constants or adding a brief comment explaining how they were chosen to make future tuning easier.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- By switching from value-based de-duplication to simply concatenating `down_items` and `up_items`, the same item with identical value and different positions may now be clicked twice; if that’s unintended, consider reintroducing a positional or value-based de-duplication step before sorting.
- The 0.1-second sleep after `WithdrawMoneySwipeUp` looks quite tight for UI animations; if you’re targeting a variety of devices or frame rates, it may be worth making this delay configurable or slightly longer to avoid intermittent recognition issues.
- The new timing constants in `_click_rect` (two 0.05-second sleeps) are currently “magic numbers”; consider extracting them into named constants or adding a brief comment explaining how they were chosen to make future tuning easier.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
close #274
Summary by Sourcery
改进 WithdrawMoney 项目的选择逻辑,以避免在快速连续点击时出现错误滚动,并调整基于识别的项目收集方式。
Bug Fixes(错误修复):
Enhancements(增强改进):
Original summary in English
Summary by Sourcery
Improve WithdrawMoney item selection to avoid erroneous scrolling on quick consecutive taps and adjust recognition-based item collection.
Bug Fixes:
Enhancements: