Reset the canvas transform instead of compounding scale on resize

Analysis

By Juliet Ramos, Playable Production Editor3 min read

View author profile
Reset the canvas transform instead of compounding scale on resize

Reset the canvas transform instead of compounding scale on resize. A runnable teaching fixture with synthetic cases, a broken branch, and explicit untested cells.

A canvas can grow its contents on every resize when a density transform is multiplied repeatedly. This fixture isolates the matrix-state mistake behind that cumulative scaling.

This edition 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: canvas transform is the governing reference for the browser primitive. MDN documents setTransform as setting the canvas transformation matrix, in contrast to composing an additional transform. The fixture models the scale component of that state rather than rendering through a real canvas context. The fixture policy around that primitive is ours.

The failure the fixture isolates

The input is a sequence of desired density scales. The corrected branch replaces the previous scale with the latest value. The broken branch multiplies every value into the accumulated transform. Repeating the same resize therefore changes the broken result even though the desired final layout is unchanged.

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

Reference table
CaseInputExpected (fixed)Broken output
one density update`[2]``2``2`
repeated identical update`[2,2,2]``2``8`
density returns to one`[2,1]``1``2`

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

What a pass does not prove

The test proves idempotent scale assignment in the simplified model. It does not verify the actual canvas state, drawing order, clipping region or image quality. A production renderer should explicitly establish its transform at the start of a drawing pass rather than depend on whichever state a previous pass happened to leave.

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

Next check on a real build

Trigger repeated same-size layout events in the real build and compare known object coordinates before and after. Restore or reset the transform before applying the desired logical-to-backing mapping. Test this together with the density policy, because a correct buffer size cannot compensate for an incorrectly accumulated drawing transform.

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.

Featured

Related posts

measurement

playable ads

·

1 min read

Playable completers vs video viewers: downstream payer quality

measurement

playable ads

·

3 min read

Stop simulation time while the document is hidden

measurement

playable ads

·

3 min read

Fit the whole playable stage inside a narrow viewport

measurement

playable ads

·

2 min read

Require both intersection and document visibility before advancing

More from the Measurement desk

Airbridge adds Amazon Ads as an app measurement channel

measurement

·

2 min read

Airbridge adds Amazon Ads as an app measurement channel

measurement

·

2 min read

When to freeze a cohort for payback review (and when not to)

measurement

media buying

·

1 min read

Using predicted LTV in bids: disclosure checklist for the UA team

measurement

media buying

·

1 min read

Blended ROAS targets that hide channel failure in F2P portfolios