1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-02 14:49:16 +02:00

Update padding to allow overrides

This commit is contained in:
Fred Chasen 2018-07-20 16:25:54 -07:00
parent 1037e867d2
commit 8f887bd9ef
3 changed files with 35 additions and 7 deletions

View file

@ -924,17 +924,22 @@ class Rendition {
});
}
let computed = contents.window.getComputedStyle(contents.content, null);
let height = contents.content.offsetHeight - (parseFloat(computed.paddingTop) + parseFloat(computed.paddingBottom));
contents.addStylesheetRules({
"img" : {
"max-width": (this._layout.columnWidth ? this._layout.columnWidth + "px" : "100%") + "!important",
"max-height": (this._layout.height ? (this._layout.height * 0.6) + "px" : "60%") + "!important",
"max-height": height + "px" + "!important",
"object-fit": "contain",
"page-break-inside": "avoid"
"page-break-inside": "avoid",
"break-inside": "avoid"
},
"svg" : {
"max-width": (this._layout.columnWidth ? this._layout.columnWidth + "px" : "100%") + "!important",
"max-height": (this._layout.height ? (this._layout.height * 0.6) + "px" : "60%") + "!important",
"page-break-inside": "avoid"
"max-height": height + "px" + "!important",
"page-break-inside": "avoid",
"break-inside": "avoid"
}
});