chore: simplify mouse input press actions#1647
Conversation
Move click and long-press sequencing, runtime coordinate conversion, and button mapping behind one stateless executor so the use case keeps only tool orchestration. Preserve the async source guard for the move.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR extracts click and long-press mouse simulation logic from SimulateMouseInputUseCase into a new MouseInputPressActionExecutor class under the Input System build. SimulateMouseInputUseCase now delegates to the new executor and removes its previous inline implementations. A test allowlist is extended accordingly. ChangesMouse Press Executor Extraction
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant UseCase as SimulateMouseInputUseCase
participant Executor as MouseInputPressActionExecutor
participant InputSystem as Unity Input System
participant Cleanup as MouseInputMainThreadCleanup
UseCase->>Executor: ExecuteClick / ExecuteLongPress(request)
Executor->>Executor: validate duration, convert coordinates
Executor->>InputSystem: schedule mouse position update
Executor->>InputSystem: simulate button down
Executor->>Executor: await press applied, await duration
alt timed out
Executor->>Cleanup: schedule timed-out cleanup
else paused
Executor->>Executor: clear overlay state, return interrupted
else completed
Executor->>Cleanup: ReleaseButtonIfPossible / ButtonUp
end
Executor-->>UseCase: response
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
User Impact
Changes
ExecuteClick,ExecuteLongPress, runtimeInputToScreen, and button mapping to statelessMouseInputPressActionExecutor.Screen.heightcoordinate contract and its rationale with the moved conversion helper.SimulateMouseInputUseCasewithout wrappers.SimulateMouseInputUseCasefrom 580 to 318 lines.Refactor Safety
try/finally,CancellationToken.Nonecleanup,ConfigureAwait(false), overlay mutations, response fields/messages, and button mapping are unchanged.Verification
git diff --check: passed.Follow-up