Skip to content

Add --angle to ui touch pinch/stretch - #1098

Merged
Nikola Metulev (nmetulev) merged 3 commits into
mainfrom
nmetulev-ui-touch-pinch-angle
Oct 15, 2026
Merged

Nikola Metulev (nmetulev) merged 3 commits into
mainfrom
nmetulev-ui-touch-pinch-angle

Conversation

@nmetulev

Copy link
Copy Markdown
Member

What and why

winapp ui touch --gesture pinch and stretch always moved the two fingers left and right. To test a zoom that tracks both axes (for example a diagonal pinch on a map or photo), you had to write your own touch-injection code.

Now --angle <degrees> turns the line the two fingers move along:

winapp ui touch img-map-9f8e -a myapp --gesture pinch --distance 300 --angle 45
  • 0 is horizontal (the default, so existing commands behave the same), 90 is vertical, and 45 runs from lower-left to upper-right (counter-clockwise, like a math angle).
  • Values must be 0–359. Anything else fails with invalid_arguments.
  • --angle with tap, double-tap, long-press, or swipe fails with invalid_arguments, matching how --direction and --to-point are handled.

For example, --at 400,300 --distance 100 --angle 90 moves the fingers from 400,350 and 400,250 toward 400,304 and 400,296.

Closes #1093
Part of #1084

Before / after

Before (main)

before

After (the first command gets past argument checks and only stops because no app named myapp is running)

after

Not tested / risks

  • I couldn't inject touch into a real window on my machine: Windows refused to bring the target window to the front from a background process (foreground_not_target). The injection code is unchanged; only the finger coordinates are new, and unit tests check them for every angle from 0 to 359.
  • With --distance below 12, each finger now starts 6 px from the center instead of 5. Without this, rounding at some angles (for example 26°) produced a finger that didn't move. With --distance 12 or more, the default output is the same as before.

Checklist

  • Tests added or updated
  • Tested locally on Windows
  • Docs, samples, and plugins/winapp/skills/ updated if user-facing behavior changed
Notes for reviewers
  • PointerGesturePlanner.PlanTouch is public in the Microsoft.Windows.SDK.BuildTools.WinApp.UIAutomation NuGet package, which shipped in 0.7.1. To avoid a binary break, the old signature stays and forwards to a new overload that takes angleDegrees.
  • I chose 0–359 instead of accepting any number and normalizing it, so a typo like 450 fails instead of quietly meaning 90.

Rotates the two pinch/stretch fingers around the anchor (0 = horizontal, 90 = vertical).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 22:57
@nmetulev Nikola Metulev (nmetulev) added the agent-preparing Agent is addressing feedback or completing required validation and CI label Oct 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

No blocking defects were identified, but angled touch delivery into a real window remains unverified and needs human validation.

0 open findings

What changed in this PR

Adds --angle to ui touch pinch and stretch gestures, enabling vertical and diagonal zoom testing.

Changes:

  • Rotates finger paths while preserving the existing public planner signature.
  • Validates angle values and gesture compatibility, with coordinate and CLI tests.
  • Updates user documentation and plugin examples.
File Description
src/​winapp-CLI/​WinApp.UIAutomation/​Input/​PointerGesturePlanner.cs Adds angled finger paths and adjusts minimum travel.
src/​winapp-CLI/​WinApp.UIAutomation.Tests/​PointerGesturePlannerTests.cs Tests rotation, symmetry, and movement across all integer angles.
src/​winapp-CLI/​WinApp.Cli/​Commands/​UiTouchCommand.cs Adds, validates, and forwards --angle.
src/​winapp-CLI/​WinApp.Cli.Tests/​UiCommandTests.Touch.cs Tests vertical movement and invalid arguments.
plugins/​winapp/​skills/​winapp-ui-automation/​SKILL.md Documents angle usage for agents.
docs/​ui-automation.md Adds the option reference and diagonal example.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

⏳ Build in progress — metrics below are from a previous commit and will update when the current build finishes.

Build Metrics Report

Validation passed. All required build and validation jobs succeeded.

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 59.50 MB 59.50 MB 📈 +2.0 KB (+0.00%)
CLI (x64) 59.48 MB 59.48 MB 📈 +2.0 KB (+0.00%)
MSIX (ARM64) 24.71 MB 24.71 MB 📉 -1.6 KB (-0.01%)
MSIX (x64) 26.21 MB 26.21 MB 📉 -0.2 KB (-0.00%)
NPM Package 51.54 MB 51.54 MB 📉 -0.2 KB (-0.00%)
NuGet Package 51.65 MB 51.65 MB 📈 +0.3 KB (+0.00%)

.NET Test Results (TRX reports)

Other suites are reflected in the overall validation status above.

✅ 8712 passed, 39 skipped out of 8751 tests in 1429.3s (+15 tests, -186.5s vs. baseline)

Test Coverage

✅ 87.5% line coverage, 81.9% branch coverage · ✅ no change vs. baseline

CLI Startup Time

71ms median (x64, winapp --version) · ✅ -9ms vs. baseline

Try This Build

Installs the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing.

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 1098
Switching between builds often?

Put the tool on your PATH once:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPath

Then this build is just:

winapp-pr 1098

Run winapp-pr with no arguments to pick from a list of open PRs.


Updated 2026-10-15 19:26:43 UTC · commit c23bc4b · workflow run

@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 14, 2026
@nmetulev Nikola Metulev (nmetulev) added agent-preparing Agent is addressing feedback or completing required validation and CI ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 15, 2026
@nmetulev
Nikola Metulev (nmetulev) merged commit 52de26a into main Oct 15, 2026
14 checks passed
@nmetulev
Nikola Metulev (nmetulev) deleted the nmetulev-ui-touch-pinch-angle branch October 15, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: --angle for ui touch --gesture pinch / stretch

3 participants