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", "name": "epubjs",
"version": "0.3.43", "version": "0.3.44",
"description": "Parse and Render Epubs", "description": "Parse and Render Epubs",
"main": "lib/index.js", "main": "lib/index.js",
"module": "src/index.js", "module": "src/index.js",

View file

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

View file

@ -207,6 +207,7 @@ class DefaultViewManager {
var displaying = new defer(); var displaying = new defer();
var displayed = displaying.promise; 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 // Check to make sure the section we want isn't already shown
var visible = this.views.find(section); var visible = this.views.find(section);
@ -217,6 +218,7 @@ class DefaultViewManager {
displaying.resolve(); displaying.resolve();
return displayed; return displayed;
} }
*/
// Hide all current views // Hide all current views
this.clear(); this.clear();

View file

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

View file

@ -105,7 +105,7 @@ class Themes {
for (var name in themes) { for (var name in themes) {
if (themes.hasOwnProperty(name) && (name === this._current || name === "default")) { if (themes.hasOwnProperty(name) && (name === this._current || name === "default")) {
theme = themes[name]; 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.add(name, contents);
} }
this._injected.push(name); this._injected.push(name);
@ -120,7 +120,7 @@ class Themes {
add (name, contents) { add (name, contents) {
var theme = this._themes[name]; var theme = this._themes[name];
if (!theme) { if (!theme || !contents) {
return; return;
} }