Skip to content

docs(Image): Add a state clip toggle to the sports territories example - #1033

Merged
techniq merged 2 commits into
mainfrom
techniq/sports-territories-clip-toggle
Nov 25, 2026
Merged

techniq merged 2 commits into
mainfrom
techniq/sports-territories-clip-toggle

Conversation

@techniq

@techniq techniq commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Adds a toggle to the Image/sports-territories example for clipping territories to states (on by default, as before): a scissors icon button beside the US / US + Canada choice, styled like the conference focus button (light background while on, aria-pressed, a tooltip saying what clicking does). Both icon buttons are now round (leading-none, so their height follows the icon rather than the line height).

Turned off, territories ignore state lines: each team gets its share of the whole map, against every other team, rather than of its own state. The map is merged into one shape with topojson's merge (states, plus provinces on "US + Canada") and used as the Voronoi's clip. Both modes go through the same list of clip shapes, so the hover outline and the conference focus work unchanged.

  • Insets stay separate. On the US map, geoAlbersUsa draws Alaska and Hawaii as insets beside California, and territories are measured on screen, so a whole-map clip handed Alaska to San Diego State. The insets are still divided on their own; on "US + Canada" (a real projection) Alaska joins the rest.
  • Canada with clipping off. For leagues without Canadian teams, the nearest US teams claim the provinces (ex. Maine over Quebec in college football). That's what turning clipping off means; easy to limit to the US for those leagues if we'd rather.

Checked in the browser: 266 D-I football territories either way, D-III's 244 re-dividing in ~170 ms, hover outlines, "US + Canada", and switching back on.

🤖 Generated with Claude Code

…example

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c51b8a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/layerchart@1033
npm i https://pkg.pr.new/@layerchart/webgl@1033

commit: c51b8a6

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment

https://pr-1033-layerchart.techniq.workers.dev

Built from c51b8a6.

…side the map choice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@techniq techniq changed the title docs(Image): Add a "Clip to states" switch to the sports territories example docs(Image): Add a state clip toggle to the sports territories example Nov 25, 2026
@techniq
techniq merged commit 70d2b0e into main Nov 25, 2026
9 checks passed
@techniq
techniq deleted the techniq/sports-territories-clip-toggle branch November 25, 2026 19:55
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