Repository navigation
feat: opt-in ui coordinate space for explicit swipe/touch coordinates - #74
Merged
Merged
Conversation
Explicit swipe/touch coordinates keep their device-native portrait default - the issue #34 acceptance contract - and gain --coordinate-space ui to opt endpoints into the visual space describe-ui prints. In ui mode the endpoints ride a per-command orientation calibration (the shared UISpaceCalibrationLoader, reused by the gesture presets from the previous commit); a failed calibration degrades to native dispatch with an advisory in the envelope. Native mode stays zero-cost: no tree fetch, no calibration, and no advisory noise. touch accepts ui in the atomic --down --up form only: a split touch could straddle a rotation and its two halves would calibrate independently into different spaces. Batch swipe/touch steps share the batch-wide calibration via the new BatchContext.uiSpaceCalibration helper (the gesture step converges on it too), and an unreachable AX tree records a step-prefixed advisory instead of failing the batch. The top-level cross-platform commands accept the flag everywhere and ignore it on Android, where display coordinates already rotate with the UI. TDD: CoordinateSpaceTests written first against the flag-only stub - 7 failures (split-touch rejection, batch ui calibration for swipe and touch, fetch-failure advisory) with the native zero-cost cases green, then implemented to a full pass. 1190 tests green. Closes #66 (PR B; PR A made directional gesture presets orientation-aware) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rir4WwrPShf5DYzziJ8RyC Signed-off-by: onevcat <onevcat@gmail.com>
Review follow-up: the top-level swipe/touch help promises the flag is accepted and ignored on Android, and every android direct command mirrors its top-level/iOS flag surface - but android swipe/touch rejected it at parse time. Declare the option on both as a documented no-op (Android coordinates are display space and already rotate with the UI) and pin the parity with parser tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rir4WwrPShf5DYzziJ8RyC Signed-off-by: onevcat <onevcat@gmail.com>
This was referenced Sep 15, 2026
Coordinate-space contract differs across tap/touch/swipe/gesture, and is only partly documented
#142
Open
onevcat
pushed a commit
that referenced
this pull request
Sep 16, 2026
`swipe` and `touch` gained `--coordinate-space` in #74, but `tap` did not — so a coordinate read off the `describe-ui` outline and passed to `tap -x/-y` was always dispatched in device-native portrait space and landed elsewhere on a rotated device, with no flag to correct it. Explicit `-x/-y` / `--point` now accept `ui`, which runs the point through the same orientation calibration selector taps already ride (#34). `native` stays the default and stays zero-cost: no AX round-trip, no calibration. Batch `tap` steps take the batch-wide calibration, the way `swipe` / `touch` steps already do. Aliases and selectors resolve their own coordinates from the AX tree, which is already ui space and already calibrated, so the flag has nothing to act on there. Combining them rejects rather than silently accepting a no-op, matching how `--frame` already rejects targeting forms it cannot apply to. Refs #142 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xerol Wong <hlchbzz@gmail.com>
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.
Closes #66 — PR B of two, stacked on #73 (base is
fix/gesture-orientation; GitHub will retarget tomainwhen #73 merges).What
Explicit
swipe/touchcoordinates keep their device-native portrait default — the #34 acceptance contract, so no existing script changes behavior — and gain--coordinate-space native|ui:ui: endpoints are given in the visual spacedescribe-uiprints and are orientation-calibrated per command (per batch-run for batch steps, shared with tap selector steps and gesture presets via the newBatchContext.uiSpaceCalibrationhelper). Coordinates lifted from the outline now stay correct on a rotated device.native(default): bit-for-bit the previous behavior — zero-cost, no tree fetch, no calibration, no advisory noise. The rotated-device advisory is deliberately not added to native mode: detecting rotation would itself cost an AX calibration on every raw swipe/touch.touch --coordinate-space uirequires the atomic--down --upform. A split touch could straddle a rotation and its two halves would calibrate independently into different spaces; v1 rejects it in shared validation (standalone, top-level, and batch parse all inherit it).orientation_calibration_fallbackadvisory in the envelope / batch result — never silent.Testing
CoordinateSpaceTestswritten against the flag-only stub first — 7 red (split-touch rejection ×2, batch ui calibration for swipe/touch, fetch-failure advisory, batch split rejection) with the native zero-cost cases green from the start, then implemented to a full pass.ExecutionResults.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rir4WwrPShf5DYzziJ8RyC