Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue : #1384 Fix blank page when resize occurs before first page is rendered #1385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/managers/default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions src/rendition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down