allow the last page in double page mode to be blank
This commit is contained in:
parent
226a772452
commit
108e696d6b
6 changed files with 15 additions and 12 deletions
|
@ -16,8 +16,8 @@ class Canvas extends EventEmitter {
|
|||
drawImage (page, page2, opts = {}) {
|
||||
this.emit('draw:start')
|
||||
|
||||
if (!(page2 instanceof window.Image)) {
|
||||
opts = page2
|
||||
if (page2 === null || !(page2 instanceof window.Image)) {
|
||||
opts = page2 || opts
|
||||
}
|
||||
|
||||
let options = Object.assign({
|
||||
|
@ -25,7 +25,7 @@ class Canvas extends 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')
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class Canvas extends 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
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue