Fix black border at strong album art zoom by scaling the recenter shift

The centering Translate formula, (1-s)*(ART_SIZE/2), was derived assuming
it's applied in final output pixels. That held up at a moderate zoom
(1.4x) but pushed past the image's actual edge at a strong one (1.7x) --
a real, on-device black border in the bottom-right corner, confirmed with
the calibration tool (true black RGB(0,0,0) pixels, not just dark
content).

Dividing the shift by the scale factor keeps the crop inside the image's
bounds at every zoom level the app offers, verified via the calibration
tool at 1.0/1.15/1.4/1.7x and against a live station -- at the cost of
the most extreme (1.7x) setting being very slightly off-center rather
than perfectly centered, which is a trade worth making since going
outside the art's bounds is worse. Moderate and subtle remain visibly
centered.
This commit is contained in:
poprhythm committed 2026-10-01 22:23:52 -04:00
1 parent 16ac004d06
commit 9f2216c692
2 files changed
+16 -6

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ ART_ZOOM_DURATION = 200
def _art_widget(art_bytes, zoom_scale):
art = render.Image(src = art_bytes, width = ART_SIZE, height = ART_SIZE)
top_scale = max(zoom_scale, 1.0)
shift = (1.0 - top_scale) * (ART_SIZE / 2.0)
shift = (1.0 - top_scale) * (ART_SIZE / 2.0) / top_scale
zoom = animation.Transformation(
child = art,
duration = ART_ZOOM_DURATION,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.