tldraw/packages
alex 39cb6bf49b
fix png images with pixel ratios <0.5 crashing the app (#2350)
When we handle pixel ratios in .png files, we were rounding the pixel
ratio to the nearest integer. This mean that if an image had a pixel
ration less than 0.5, it would get rounded to zero. This would cause a
divide-by-zero on the width & height of the image which would crash the
app.

This has a couple fixes:
- we ignore pixel ratios less that 1
- we perform rounding _after_ we apply the pixel ratio to the
width/height

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Upload this funky image:
![shapes_5](https://github.com/tldraw/tldraw/assets/1489520/80fb41fa-3be1-4dbd-8e2f-d81013b09780)
2. Check the app doesn't crash
2023-12-19 12:35:42 +00:00
..
assets Change licenses to tldraw (#2167) 2023-12-19 10:41:01 +00:00
editor Drop edge scrolling adjustment for mobile (#2346) 2023-12-19 11:47:40 +00:00
state Change licenses to tldraw (#2167) 2023-12-19 10:41:01 +00:00
store Change licenses to tldraw (#2167) 2023-12-19 10:41:01 +00:00
tldraw Drop edge scrolling adjustment for mobile (#2346) 2023-12-19 11:47:40 +00:00
tlschema Change licenses to tldraw (#2167) 2023-12-19 10:41:01 +00:00
utils fix png images with pixel ratios <0.5 crashing the app (#2350) 2023-12-19 12:35:42 +00:00
validate Change licenses to tldraw (#2167) 2023-12-19 10:41:01 +00:00