andrewstephens75 / as-dithered-image

HTML custom element to correctly dither an image giving pixel-perfect crisp results on all displays
MIT License
176 stars 2 forks source link

Finally brute-force fixed the problem with scaled views #10

Closed andrewstephens75 closed 8 months ago

andrewstephens75 commented 8 months ago

Certain browsers (basically everything except Safari) had problems with the viewport was scaled and devicePixelRatio returned non-integer values. This caused corrupt images.

The cause was two problems. The crunch factor was not updated correctly when the zoom factor changed and the adjustedPixelSize was not rounded properly.