mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
fixed rendering loop
This commit is contained in:
parent
d73133e2c7
commit
5058ced1c4
9 changed files with 198 additions and 55 deletions
|
@ -55,8 +55,8 @@ EPUBJS.Renderer.prototype.initialize = function(_options){
|
|||
this.container = document.createElement("div");
|
||||
this.infinite = new EPUBJS.Infinite(this.container, this);
|
||||
|
||||
this.container.style.width = height;
|
||||
this.container.style.height = width;
|
||||
this.container.style.width = width;
|
||||
this.container.style.height = height;
|
||||
this.container.style.overflow = "scroll";
|
||||
|
||||
if(options.hidden) {
|
||||
|
@ -132,12 +132,21 @@ EPUBJS.Renderer.prototype.attachTo = function(_element){
|
|||
|
||||
};
|
||||
|
||||
EPUBJS.Renderer.prototype.clear = function(){
|
||||
this.views.forEach(function(view){
|
||||
view.destroy();
|
||||
});
|
||||
|
||||
this.views = [];
|
||||
};
|
||||
|
||||
EPUBJS.Renderer.prototype.display = function(what){
|
||||
var displaying = new RSVP.defer();
|
||||
var displayed = displaying.promise;
|
||||
var view = new EPUBJS.View();
|
||||
|
||||
|
||||
// Clear views
|
||||
this.clear();
|
||||
|
||||
this.book.opened.then(function(){
|
||||
var section = this.book.spine.get(what);
|
||||
var rendered = this.render(section);
|
||||
|
@ -233,9 +242,11 @@ EPUBJS.Renderer.prototype.backwards = function(view){
|
|||
|
||||
// -- this might want to be in infinite
|
||||
EPUBJS.Renderer.prototype.fill = function() {
|
||||
console.log("filling")
|
||||
var filling = this.backwards();
|
||||
var height = this.container.getBoundingClientRect().height;
|
||||
|
||||
if(!filling) return;
|
||||
|
||||
filling.then(function(){
|
||||
var bottom = this.last().bounds().bottom;
|
||||
while (height && bottom && bottom < height) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue