Workaround for "0 width/height" api responses

This needs a more proper fix probably.
This commit is contained in:
tr7zw 2022-06-07 16:09:02 +02:00
parent ea35faee91
commit ae583cf2a9

View File

@ -29,14 +29,14 @@ const readerComponent = () => {
return {
id: i + 1,
url: `${base_url}api/page/${tid}/${eid}/${i+1}`,
width: d.width,
height: d.height,
width: d.width == 0 ? "100%" : d.width,
height: d.height == 0 ? "100%" : d.height,
};
});
const avgRatio = this.items.reduce((acc, cur) => {
const avgRatio = dimensions.reduce((acc, cur) => {
return acc + cur.height / cur.width
}, 0) / this.items.length;
}, 0) / dimensions.length;
console.log(avgRatio);
this.longPages = avgRatio > 2;