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

Balance columns, prevent scroll past end of content

This commit is contained in:
fchasen 2015-06-28 23:29:02 -04:00
parent 4e566dde12
commit 3e9f8a609a
5 changed files with 26 additions and 12 deletions

15
dist/epub.js vendored
View file

@ -4759,7 +4759,7 @@ EPUBJS.Layout.Reflowable.prototype.calculate = function(_width, _height, _gap, _
var colWidth;
var spreadWidth;
var delta;
//-- Double Page
if(divisor > 1) {
colWidth = Math.floor((width - gap) / divisor);
@ -4770,7 +4770,7 @@ EPUBJS.Layout.Reflowable.prototype.calculate = function(_width, _height, _gap, _
spreadWidth = colWidth * divisor;
delta = (colWidth + gap) * divisor;
this.columnAxis = EPUBJS.core.prefixed('columnAxis');
@ -4805,7 +4805,7 @@ EPUBJS.Layout.Reflowable.prototype.format = function(view){
//-- Add columns
$body.style[this.columnAxis] = "horizontal";
$body.style[this.columnFill] = "auto";
$body.style[this.columnFill] = "balance";
$body.style[this.columnGap] = this.gap+"px";
$body.style[this.columnWidth] = this.column+"px";
@ -6091,7 +6091,14 @@ EPUBJS.Paginate.prototype.page = function(pg){
EPUBJS.Paginate.prototype.next = function(){
return this.q.enqueue(function(){
this.scrollBy(this.layout.delta, 0);
// console.log(this.container.scrollWidth, this.container.scrollLeft + this.container.offsetWidth + this.layout.delta)
if(this.container.scrollLeft +
this.container.offsetWidth +
this.layout.delta < this.container.scrollWidth) {
this.scrollBy(this.layout.delta, 0);
} else {
this.scrollTo(this.container.scrollWidth - this.layout.delta, 0);
}
this.reportLocation();
return this.check();
});

6
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -126,7 +126,7 @@
height: 600
});
var displayed = rendition.display();
var displayed = rendition.display(12);
displayed.then(function(renderer){

View file

@ -18,7 +18,7 @@ EPUBJS.Layout.Reflowable.prototype.calculate = function(_width, _height, _gap, _
var colWidth;
var spreadWidth;
var delta;
//-- Double Page
if(divisor > 1) {
colWidth = Math.floor((width - gap) / divisor);
@ -29,7 +29,7 @@ EPUBJS.Layout.Reflowable.prototype.calculate = function(_width, _height, _gap, _
spreadWidth = colWidth * divisor;
delta = (colWidth + gap) * divisor;
this.columnAxis = EPUBJS.core.prefixed('columnAxis');
@ -64,7 +64,7 @@ EPUBJS.Layout.Reflowable.prototype.format = function(view){
//-- Add columns
$body.style[this.columnAxis] = "horizontal";
$body.style[this.columnFill] = "auto";
$body.style[this.columnFill] = "balance";
$body.style[this.columnGap] = this.gap+"px";
$body.style[this.columnWidth] = this.column+"px";

View file

@ -163,7 +163,14 @@ EPUBJS.Paginate.prototype.page = function(pg){
EPUBJS.Paginate.prototype.next = function(){
return this.q.enqueue(function(){
this.scrollBy(this.layout.delta, 0);
// console.log(this.container.scrollWidth, this.container.scrollLeft + this.container.offsetWidth + this.layout.delta)
if(this.container.scrollLeft +
this.container.offsetWidth +
this.layout.delta < this.container.scrollWidth) {
this.scrollBy(this.layout.delta, 0);
} else {
this.scrollTo(this.container.scrollWidth - this.layout.delta, 0);
}
this.reportLocation();
return this.check();
});