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

Fix blank page when resize occurs before first page is rendered

This commit is contained in:
Vincent Meyer 2024-05-10 11:06:05 +02:00
parent f09089cf77
commit 09c18188a6
2 changed files with 11 additions and 3 deletions

View file

@ -233,7 +233,7 @@ class DefaultViewManager {
this.emit(EVENTS.MANAGERS.RESIZED, { this.emit(EVENTS.MANAGERS.RESIZED, {
width: this._stageSize.width, width: this._stageSize.width,
height: this._stageSize.height height: this._stageSize.height
}, epubcfi); }, epubcfi || this.target);
} }
createView(section, forceRight) { createView(section, forceRight) {
@ -265,6 +265,9 @@ class DefaultViewManager {
target = undefined; 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 // Check to make sure the section we want isn't already shown
var visible = this.views.find(section); var visible = this.views.find(section);
@ -897,6 +900,8 @@ class DefaultViewManager {
this.scrollTop = scrollTop; this.scrollTop = scrollTop;
this.scrollLeft = scrollLeft; this.scrollLeft = scrollLeft;
this.target = undefined
if(!this.ignore) { if(!this.ignore) {
this.emit(EVENTS.MANAGERS.SCROLL, { this.emit(EVENTS.MANAGERS.SCROLL, {
top: scrollTop, top: scrollTop,

View file

@ -476,8 +476,11 @@ class Rendition {
height: size.height height: size.height
}, epubcfi); }, epubcfi);
if (this.location && this.location.start) { if (epubcfi) {
this.display(epubcfi || this.location.start.cfi); this.display(epubcfi)
}
else if (this.location && this.location.start) {
this.display(this.location.start.cfi);
} }
} }