mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Workaround for "0 width/height" api responses
This needs a more proper fix probably.
This commit is contained in:
parent
ea35faee91
commit
ae583cf2a9
@ -29,14 +29,14 @@ const readerComponent = () => {
|
|||||||
return {
|
return {
|
||||||
id: i + 1,
|
id: i + 1,
|
||||||
url: `${base_url}api/page/${tid}/${eid}/${i+1}`,
|
url: `${base_url}api/page/${tid}/${eid}/${i+1}`,
|
||||||
width: d.width,
|
width: d.width == 0 ? "100%" : d.width,
|
||||||
height: d.height,
|
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
|
return acc + cur.height / cur.width
|
||||||
}, 0) / this.items.length;
|
}, 0) / dimensions.length;
|
||||||
|
|
||||||
console.log(avgRatio);
|
console.log(avgRatio);
|
||||||
this.longPages = avgRatio > 2;
|
this.longPages = avgRatio > 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user