Skip to content

Match offset arc hit regions to rendered geometry - #12369

Open
hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix-offset-arc-hit-testing
Open

hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix-offset-arc-hit-testing

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 26, 2026

Copy link
Copy Markdown

Problem

ArcElement.draw() translates an offset arc and expands its radii, but inRange() checks against the unshifted center and radii. With a semicircular doughnut arc (innerRadius: 60, outerRadius: 100, offset: 40), points in the outer painted band are missed while points in the empty inner hole are accepted.

Change

Apply the existing draw translation and circumference-dependent radial offset when testing the arc. The inner radius remains zero for pie slices. Final animated positions and angles still come from getProps().

This does not change rendered geometry, the spacing/border-width hit conventions, tooltip positions, or spacing modes. It is separate from changing the offset layout discussed in #10286 and #10469.

Tests

Added 33 cases covering:

  • Opaque painted and empty radial interior pixels across four arc spans and four rotations
  • Pie/doughnut radial bounds with offset, spacing and border-width controls
  • Animated final positions and angles

25 of these cases fail against the unchanged implementation.

Validation after a fresh frozen-lockfile dependency install:

  • Native Karma suite in headless Chrome: 1736 passed
  • Arc suite: 53 passed
  • pnpm build, including declarations: passed
  • tsc --noEmit: passed
  • Changed-file ESLint: 0 errors; four existing arc-source warnings unchanged

Firefox and downstream integration suites were not run.

hakarrr and others added 2 commits October 26, 2026 20:22
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant