diff --git a/src/managers/default/index.js b/src/managers/default/index.js index 2812d87..0d93610 100644 --- a/src/managers/default/index.js +++ b/src/managers/default/index.js @@ -233,7 +233,7 @@ class DefaultViewManager { this.emit(EVENTS.MANAGERS.RESIZED, { width: this._stageSize.width, height: this._stageSize.height - }, epubcfi); + }, epubcfi || this.target); } createView(section, forceRight) { @@ -265,6 +265,9 @@ class DefaultViewManager { target = undefined; } + // If the window is resized before rendered, call resize with original target + this.target = target + // Check to make sure the section we want isn't already shown var visible = this.views.find(section); @@ -897,6 +900,8 @@ class DefaultViewManager { this.scrollTop = scrollTop; this.scrollLeft = scrollLeft; + this.target = undefined + if(!this.ignore) { this.emit(EVENTS.MANAGERS.SCROLL, { top: scrollTop, diff --git a/src/rendition.js b/src/rendition.js index 14a21b4..e2dd1f9 100644 --- a/src/rendition.js +++ b/src/rendition.js @@ -476,8 +476,11 @@ class Rendition { height: size.height }, epubcfi); - if (this.location && this.location.start) { - this.display(epubcfi || this.location.start.cfi); + if (epubcfi) { + this.display(epubcfi) + } + else if (this.location && this.location.start) { + this.display(this.location.start.cfi); } }