1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Temp disable scrolling to visible, always re-render

This commit is contained in:
Fred Chasen 2017-08-02 22:09:52 -04:00
parent 6401485f48
commit c2b3284259
5 changed files with 20 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"name": "epubjs",
"version": "0.3.43",
"version": "0.3.44",
"description": "Parse and Render Epubs",
"main": "lib/index.js",
"module": "src/index.js",

View file

@ -614,7 +614,9 @@ class Contents {
content = this.content || this.document.body;
if (content) {
content.classList.add(className);
}
}
@ -625,7 +627,9 @@ class Contents {
content = this.content || this.document.body;
if (content) {
content.classList.remove(className);
}
}
@ -891,7 +895,7 @@ class Contents {
mark(cfiRange, data={}, cb) {
if (cfiRange in this.marks) {
item = this.marks[cfiRange];
let item = this.marks[cfiRange];
return item;
}

View file

@ -207,6 +207,7 @@ class DefaultViewManager {
var displaying = new defer();
var displayed = displaying.promise;
/* TODO: this needs more testing, always re-render for now
// Check to make sure the section we want isn't already shown
var visible = this.views.find(section);
@ -217,6 +218,7 @@ class DefaultViewManager {
displaying.resolve();
return displayed;
}
*/
// Hide all current views
this.clear();

View file

@ -322,9 +322,15 @@ class Rendition {
* @param {*} view
*/
afterDisplayed(view){
if (view.contents) {
this.hooks.content.trigger(view.contents, this).then(() => {
this.emit("rendered", view.section, view);
});
} else {
console.log("no contents", view.index);
this.emit("rendered", view.section, view);
}
// this.reportLocation();
}

View file

@ -105,7 +105,7 @@ class Themes {
for (var name in themes) {
if (themes.hasOwnProperty(name) && (name === this._current || name === "default")) {
theme = themes[name];
if(theme.rules || (theme.url && links.indexOf(theme.url) === -1)) {
if((theme.rules && Object.keys(theme.rules).length > 0) || (theme.url && links.indexOf(theme.url) === -1)) {
this.add(name, contents);
}
this._injected.push(name);
@ -120,7 +120,7 @@ class Themes {
add (name, contents) {
var theme = this._themes[name];
if (!theme) {
if (!theme || !contents) {
return;
}