Whichever way around the aspect ratio is (see #14), this code seems broken.
viewBox is x offset, y offset, width, height.
For height you have 10 * (1 - ratio).
But ratio can be any number greater than zero and less than infinity. If ratio is 2, for example (either a 100x200 or 200x100 image, depending how the ratio is calculated), this will evaluate to a height of -10.
I came across this piece of code:
https://github.com/timse/srcset-loader/blob/61c127efb001fce4414ba4fa9d889fe520ae10c8/src/runtime.js#L18-L23
Whichever way around the aspect ratio is (see #14), this code seems broken.
viewBox
is x offset, y offset, width, height.For height you have
10 * (1 - ratio)
.But ratio can be any number greater than zero and less than infinity. If ratio is 2, for example (either a 100x200 or 200x100 image, depending how the ratio is calculated), this will evaluate to a height of -10.