allow the last page in double page mode to be blank

This commit is contained in:
Bala Clark 2015-07-20 22:54:45 +02:00
parent 226a772452
commit 108e696d6b
6 changed files with 15 additions and 12 deletions

8
dist/comicbook.js vendored
View file

@ -226,8 +226,8 @@ var Canvas = (function (_EventEmitter) {
this.emit('draw:start');
if (!(page2 instanceof window.Image)) {
opts = page2;
if (page2 === null || !(page2 instanceof window.Image)) {
opts = page2 || opts;
}
var options = _Object$assign({
@ -235,7 +235,7 @@ var Canvas = (function (_EventEmitter) {
zoomMode: 'fitWidth'
}, opts);
if (!(page instanceof window.Image) || options.doublePage && !(page2 instanceof window.Image)) {
if (!(page instanceof window.Image) || options.doublePage && page2 === null) {
throw new Error('Invalid image');
}
@ -262,7 +262,7 @@ var Canvas = (function (_EventEmitter) {
if (doublePageMode) {
// for double page spreads, factor in the width of both pages
if (typeof page2 === 'object') {
if (page2 instanceof window.Image) {
width += page2.width
// if this is the last page and there is no page2, still keep the canvas wide
;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long