Skip to content

Let a progress ring's art be swapped for art of another size - #31

Merged
freethinkel merged 1 commit into
mainfrom
issue-22-progress-ring
Aug 13, 2026
Merged

Let a progress ring's art be swapped for art of another size#31
freethinkel merged 1 commit into
mainfrom
issue-22-progress-ring

Conversation

@freethinkel

Copy link
Copy Markdown
Owner

Closes #22.

Resize — already fixed on main by "Give a ring one sizing rule, and stop the resize paths disagreeing". Verified rather than re-done: scaleRing is the single sizing rule, and the inspector's size field, corner drags, arrow keys and a group resize all go through it. A ring with no art resizes through its arc spec; one with art rescales its pixels and moves its own circle with them.

Replacing the art — this PR. replaceImageFx wrote the new asset and nothing else, so a ring kept the circle its old bitmap had. That circle is meta.w/h, which is what drawSector pivots the filled sector around: swap a 284px ring for a 64px one and the sector still swings around a 284px centre, with the art anchored to the side of a circle it no longer fills. On screen that reads as "the image can't be replaced".

A swap is a resize by another name, so it now goes through the same rule — fitRingsToArt scales every ring drawing the asset (assets are shared) by the factor the new pixels bring. scaleRing also carries spec.radius through the with-art case now: 0x5b never writes a radius, but an editor-made 0x5a ring does, so replacing or resizing its art exported a diameter the widget no longer had — the same defect addRingImageFx already fixes on the way in.

Two regression tests, both checked to fail against the old code. Full suite: 193 passing; check, lint and format:check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PgJ39ZDcxiHJt3uabAgSL8

The resize half of #22 holds: scaleRing is the one sizing rule, and the size
field, the corner drag, the arrow keys and a group resize all go through it.
Replacing the bitmap did not — replaceImageFx writes the new asset and nothing
else, so a ring kept the circle its old art had.

That circle is meta.w/h, which is what drawSector pivots the filled sector
around: swap a 284px ring for a 64px one and the sector still swings around a
284px centre, with the art anchored to the side of a circle it no longer fills.
On screen that reads as "the image can't be replaced".

A swap is a resize by another name, so it goes through the same rule:
fitRingsToArt scales every ring drawing the asset (assets are shared) by the
factor the new pixels bring. And scaleRing now carries spec.radius through the
with-art case as well — 0x5b never writes one, but an editor-made ring is 0x5a
and does, so replacing or resizing its art otherwise exported a diameter the
widget no longer had, the same defect addRingImageFx already fixes on the way
in.

Two regression tests, both checked to fail against the old code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PgJ39ZDcxiHJt3uabAgSL8
@freethinkel
freethinkel merged commit ff38b2c into main Aug 13, 2026
1 check passed
@freethinkel
freethinkel deleted the issue-22-progress-ring branch August 13, 2026 20:25
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.

Can not resize Progress Ring

1 participant