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

updated expansion rendering

This commit is contained in:
Fred Chasen 2015-02-18 13:52:08 -05:00
parent c965cb5408
commit b486232685
6 changed files with 145 additions and 78 deletions

View file

@ -282,25 +282,31 @@ EPUBJS.Rendition.prototype.afterDisplayed = function(currView){
EPUBJS.Rendition.prototype.afterDisplayedAbove = function(currView){
var bounds, style, marginTopBottom, marginLeftRight;
var prevTop = this.container.scrollTop;
var prevLeft = this.container.scrollLeft;
this.afterDisplayed(currView);
var bounds = currView.bounds(); //, style, marginTopBottom, marginLeftRight;
// var prevTop = this.container.scrollTop;
// var prevLeft = this.container.scrollLeft;
if(currView.countered) return;
bounds = currView.bounds();
// bounds = currView.bounds();
if(this.settings.axis === "vertical") {
this.infinite.scrollTo(0, prevTop + bounds.height, true)
this.infinite.scrollBy(0, bounds.height, true);
} else {
this.infinite.scrollTo(prevLeft + bounds.width, 0, true);
this.infinite.scrollBy(bounds.width, 0, true);
}
// if(this.settings.axis === "vertical") {
// currView.countered = bounds.height - (currView.countered || 0);
// this.infinite.scrollTo(0, prevTop + bounds.height, true)
// } else {
// currView.countered = bounds.width - (currView.countered || 0);
// this.infinite.scrollTo(prevLeft + bounds.width, 0, true);
// }
currView.countered = true;
this.removeShownListeners(currView);
// this.removeShownListeners(currView);
this.afterDisplayed(currView);
if(this.afterDisplayedAboveHook) this.afterDisplayedAboveHook(currView);
@ -309,8 +315,9 @@ EPUBJS.Rendition.prototype.afterDisplayedAbove = function(currView){
// Remove Previous Listeners if present
EPUBJS.Rendition.prototype.removeShownListeners = function(view){
view.off("shown", this.afterDisplayed);
view.off("shown", this.afterDisplayedAbove);
// view.off("shown", this.afterDisplayed);
// view.off("shown", this.afterDisplayedAbove);
view.onShown = function(){};
};
@ -320,7 +327,8 @@ EPUBJS.Rendition.prototype.append = function(view){
this.container.appendChild(view.element);
view.on("shown", this.afterDisplayed.bind(this));
// view.on("shown", this.afterDisplayed.bind(this));
view.onShown = this.afterDisplayed.bind(this);
// this.resizeView(view);
};
@ -329,7 +337,8 @@ EPUBJS.Rendition.prototype.prepend = function(view){
// view.prependTo(this.container);
this.container.insertBefore(view.element, this.container.firstChild);
view.on("shown", this.afterDisplayedAbove.bind(this));
view.onShown = this.afterDisplayedAbove.bind(this);
// view.on("shown", this.afterDisplayedAbove.bind(this));
// this.resizeView(view);
@ -345,7 +354,8 @@ EPUBJS.Rendition.prototype.fill = function(view){
this.container.appendChild(view.element);
view.on("shown", this.afterDisplayed.bind(this));
// view.on("shown", this.afterDisplayed.bind(this));
view.onShown = this.afterDisplayed.bind(this);
};