One Rule
Coordinates are screen pixels. A touch at(x, y) lands on the pixel at (x, y) of the phone’s screen, and every position the API answers (recognized text, detected elements, what a tap hit) is in the same pixels.
This holds on every phone, Android and iPhone alike, and for everything that carries a position: Touch, live touch, and the boxes that Get Screen returns for recognized text and detected elements. The usual loop is:
- Read the screen.
- Find what you want in the image, or in the text and elements returned with it.
- Send its position to Touch.
Details
- The origin
(0, 0)is the top-left corner of the screen as it is currently shown.xgrows to the right andygrows downward. - The size of the coordinate space is the phone’s
screenwidthandheight. Get Screen answers that size aswidthandheight. - The image itself can be smaller than the screen: when you ask for a
maxSideor aregion, and on some iPhones whose screen is captured at a lower resolution (360 pixels wide). Then the answer hasscale, image pixels per screen pixel: a point at(ix, iy)in the image is at(ix / scale, iy / scale)on the screen. Positions the API answers are already in screen pixels. - Coordinates can be fractional (
540.5). - A coordinate outside the screen is rejected with
400and the codeinvalid_request.
Example
A phone reports:(540, 1200). A swipe up from near the bottom to near the top, taking 300 milliseconds, is:
Timing
All times are in milliseconds. In Touch, each input’stime is the number of milliseconds since the finger touched down.