1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Account for Body padding if fullscreen

This commit is contained in:
Fred Chasen 2018-07-23 15:25:12 -07:00
parent 49cd45152a
commit 2df8eefd3b
2 changed files with 15 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "epubjs",
"version": "0.3.64",
"version": "0.3.65",
"description": "Parse and Render Epubs",
"main": "lib/index.js",
"module": "src/index.js",

View file

@ -198,11 +198,23 @@ class Stage {
// Bounds not set, get them from window
let _windowBounds = windowBounds();
let bodyStyles = window.getComputedStyle(document.body);
let bodyPadding = {
left: parseFloat(bodyStyles["padding-left"]) || 0,
right: parseFloat(bodyStyles["padding-right"]) || 0,
top: parseFloat(bodyStyles["padding-top"]) || 0,
bottom: parseFloat(bodyStyles["padding-bottom"]) || 0
};
if (!width) {
width = _windowBounds.width;
width = _windowBounds.width -
bodyPadding.left -
bodyPadding.right;
}
if (this.settings.fullsize || !height) {
height = _windowBounds.height;
height = _windowBounds.height -
bodyPadding.top -
bodyPadding.bottom;
}
return {