Hit region viewer

The canvas draws four elements, then asks the browser which element it would hit at every 8 px and tints each square with that element's colour. The outlines are where the canvas drew each element. Choose a case under the picture, and tap the picture to see what a tap hits.

Delivery
Leave the parcel with a neighbour.
Open the docs
tint: hit here. Outline: drawn here hit, not shown shown, not hit

Show the code record each draw, scan elementFromPoint() over a grid, compare
  1. The markup. Four drawable children.
  2. Where each element was drawn. A wrapper round drawElementImage() reads the transform at each call.
  3. Where the browser hits each element. elementFromPoint() at the centre of each square, a few rows per frame.
  4. Comparing the two.
  5. The cases. Each is a short drawing function.
  6. One frame. Draw the case, scan some rows, draw the map over the picture.
  7. The last case. Two points asked on every frame.
  8. Drawing the map.

How it works

Live checks

Each check builds a small canvas of its own in a corner of the window. The picture above isn't touched.

ResultExperimentDetail

Findings

From Chromium 157, headless, on 2026-11-21. The rows above say what your browser does.