mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Fixed locking to solve single page issues
This commit is contained in:
parent
61ebe6d16e
commit
23ca0b840d
8 changed files with 32 additions and 29 deletions
|
@ -78,7 +78,7 @@ EPUBJS.View.prototype.create = function() {
|
|||
};
|
||||
|
||||
|
||||
EPUBJS.View.prototype.lock = function(width, height) {
|
||||
EPUBJS.View.prototype.lock = function(what, width, height) {
|
||||
|
||||
var elBorders = EPUBJS.core.borders(this.element);
|
||||
var iframeBorders;
|
||||
|
@ -89,17 +89,18 @@ EPUBJS.View.prototype.lock = function(width, height) {
|
|||
iframeBorders = {width: 0, height: 0};
|
||||
}
|
||||
|
||||
if(EPUBJS.core.isNumber(width)){
|
||||
if(what == "width" && EPUBJS.core.isNumber(width)){
|
||||
this.lockedWidth = width - elBorders.width - iframeBorders.width;
|
||||
this.resize(this.lockedWidth, width); // width keeps ratio correct
|
||||
}
|
||||
|
||||
if(EPUBJS.core.isNumber(height)){
|
||||
if(what == "height" && EPUBJS.core.isNumber(height)){
|
||||
this.lockedHeight = height - elBorders.height - iframeBorders.height;
|
||||
this.resize(null, this.lockedHeight);
|
||||
this.resize(width, this.lockedHeight);
|
||||
}
|
||||
|
||||
if(EPUBJS.core.isNumber(width) &&
|
||||
if(what === "both" &&
|
||||
EPUBJS.core.isNumber(width) &&
|
||||
EPUBJS.core.isNumber(height)){
|
||||
|
||||
this.lockedWidth = width - elBorders.width - iframeBorders.width;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue