Translate viewport taps into the scaled stage's coordinates

Editorial collage hero: playable-bench-pointer-coordinate

Translate viewport taps into the scaled stage's coordinates. A runnable teaching fixture with synthetic cases, a broken branch, and explicit untested cells.

A tap can land on the visible target and still miss the game's hit test. This fixture reproduces the error caused by mixing viewport coordinates with an offset, scaled stage.

This article is a laboratory fixture. Node and the companion HTML page execute the authored functions against synthetic cases. No physical device panel was run, no ad network reviewed the build, and no campaign result is inferred from a passing test.

What the documentation actually supplies

MDN: pointer coordinate is the governing reference for the browser primitive. MDN states that getBoundingClientRect returns an element's position relative to the viewport and includes its size, padding and border. Those measurements need a consistent relationship to the game's logical coordinate space. The fixture policy around that primitive is ours.

The failure the fixture isolates

The corrected branch subtracts the stage origin and divides by the declared scale. The broken branch uses the pointer's viewport coordinate directly. The fixture supplies a simplified rectangle and uniform scale; it does not model arbitrary CSS transforms, borders or nested scrolling.

The broken branch is retained so a producer can see the exact mistake, not only the repaired output.

CaseInputExpected (fixed)Broken output
offset and doubled stage`[140,40,2]``50``140`
left edge`[30,30,0.5]``0``30`
unscaled origin`[25,0,1]``25``25`

All 3 fixed-branch cases matched the spec when executed in Node on 19 September 2026.

What a pass does not prove

A pass proves the inverse mapping for the supplied one-dimensional examples. A real hit test also needs the corresponding vertical mapping, a defined content rectangle and treatment of transformed ancestors. The central acceptance rule is that rendering and interaction agree on the same origin and scale.

Untested cells in this article: physical devices, host SDKs, network packaging limits, store-opening callbacks, and campaign performance. Those remain empty on purpose.

Next check on a real build

Show the logical coordinates in a debug overlay while tapping known corners and the centre of an authorised build. Repeat after scrolling or resizing the host. If the canvas and hit regions use different scale factors, fix that shared contract before enlarging hit boxes to conceal the mismatch.

Open the runnable fixture to re-execute the cases in a browser. Download the case record to keep inputs, expectations and limits with a QA ticket.

Background in the archive: Playable ad device testing matrix and Playable spec sheet before you build. Those guides describe practice; they are not a substitute for this fixture and this check does not recertify their every claim.

Related posts

When midcore playables should stay out of a network: kill criteria

media buying

playable ads

·

1 min read

When midcore playables should stay out of a network: kill criteria

Rewarded placement map: session minute versus ad load

media buying

playable ads

·

1 min read

Rewarded placement map: session minute versus ad load

Midcore playable: one complete loop before CTA

creative strategy

playable ads

·

1 min read

Midcore playable: one complete loop before CTA