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

Adjust viewport on contents.fit

This commit is contained in:
Fred Chasen 2017-06-08 11:52:43 -04:00
parent 176125e46b
commit a899ddd4d6
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "epubjs", "name": "epubjs",
"version": "0.3.33", "version": "0.3.34",
"description": "Parse and Render Epubs", "description": "Parse and Render Epubs",
"main": "lib/index.js", "main": "lib/index.js",
"module": "src/index.js", "module": "src/index.js",
@ -75,6 +75,6 @@
"marks-pane": "^1.0.0", "marks-pane": "^1.0.0",
"path-webpack": "^0.0.3", "path-webpack": "^0.0.3",
"stream-browserify": "^2.0.1", "stream-browserify": "^2.0.1",
"xmldom": "^0.1.27" "xmldom": "0.1.27"
} }
} }

View file

@ -685,18 +685,22 @@ class Contents {
} }
size(width, height){ size(width, height){
var viewport = { scale: 1.0, scalable: "no" };
if (width >= 0) { if (width >= 0) {
this.width(width); this.width(width);
viewport.width = width;
} }
if (height >= 0) { if (height >= 0) {
this.height(height); this.height(height);
viewport.height = height;
} }
this.css("margin", "0"); this.css("margin", "0");
this.css("box-sizing", "border-box"); this.css("box-sizing", "border-box");
this.viewport(viewport);
} }
columns(width, height, columnWidth, gap){ columns(width, height, columnWidth, gap){
@ -751,7 +755,7 @@ class Contents {
this.overflow("hidden"); this.overflow("hidden");
// Deal with Mobile trying to scale to viewport // Deal with Mobile trying to scale to viewport
this.viewport({ scale: 1.0 }); this.viewport({ width: width, height: height, scale: 1.0 });
// Scale to the correct size // Scale to the correct size
this.scaler(scale, 0, offsetY); this.scaler(scale, 0, offsetY);