Commit 145ef64
authored
fix drag mouse (#79)
Did some testing on this site:
https://master--5fc05e08a4a65d0021ae0bf2.chromatic.com/?path=/story/core-draggable-hooks-usedraggable--basic-setup
discovered that the number of steps and the delay between them as you
drag the mouse is important to finesse
found success with the defaults in this PR, but making them configurable
in case users want to deviate
# Checklist
- [ ] A link to a related issue in our repository
- [ ] A description of the changes proposed in the pull request.
- [ ] @mentions of the person or team responsible for reviewing proposed
changes.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Implements smooth drag using relative step movements with configurable
per-segment step count and per-step delay, updates OpenAPI, and adds
tests.
>
> - **Backend (server/cmd/api/api/computer.go)**:
> - **DragMouse**: Move along `path` via `mousemove_relative` steps with
small sleeps for smoothing; derive steps using `generateRelativeSteps`;
support `steps_per_segment` (default `10`) and `step_delay_ms` (default
`50`).
> - Add `generateRelativeSteps(dx, dy, steps)` helper to distribute
integer relative moves.
> - **Tests (server/cmd/api/api/computer_test.go)**:
> - Add unit tests covering zero, axis-aligned, and diagonal/sloped
cases for `generateRelativeSteps`.
> - **API/Schema**:
> - `DragMouseRequest`: add `steps_per_segment` and `step_delay_ms`
(with defaults/min constraints) in `server/openapi.yaml` and generated
`server/lib/oapi/oapi.go`.
> - `PressKeyRequest.keys` doc: note items may be combos like `Ctrl+t`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9c427f3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 4ef116e commit 145ef64
File tree
4 files changed
+233
-94
lines changed- server
- cmd/api/api
- lib/oapi
4 files changed
+233
-94
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
672 | | - | |
| 673 | + | |
| 674 | + | |
673 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
674 | 699 | | |
675 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
676 | 711 | | |
677 | 712 | | |
678 | 713 | | |
| |||
709 | 744 | | |
710 | 745 | | |
711 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments