mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-02 14:49:16 +02:00
Balance columns, prevent scroll past end of content
This commit is contained in:
parent
4e566dde12
commit
3e9f8a609a
5 changed files with 26 additions and 12 deletions
15
dist/epub.js
vendored
15
dist/epub.js
vendored
|
@ -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
6
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -126,7 +126,7 @@
|
|||
height: 600
|
||||
});
|
||||
|
||||
var displayed = rendition.display();
|
||||
var displayed = rendition.display(12);
|
||||
|
||||
|
||||
displayed.then(function(renderer){
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue