mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
New queue flush, handle cfi for display, re-display on resize
This commit is contained in:
parent
42efc34517
commit
ac926479cf
12 changed files with 941 additions and 399 deletions
|
@ -141,6 +141,13 @@ EPUBJS.Paginate.prototype.layoutUpdate = function() {
|
|||
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.moveTo = function(offset){
|
||||
var dist = Math.floor(offset.left / this.layout.delta) * this.layout.delta;
|
||||
return this.check(0, dist+this.settings.offset).then(function(){
|
||||
this.scrollBy(dist, 0);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.page = function(pg){
|
||||
|
||||
// this.currentPage = pg;
|
||||
|
@ -172,16 +179,16 @@ EPUBJS.Paginate.prototype.prev = function(){
|
|||
|
||||
EPUBJS.Paginate.prototype.reportLocation = function(){
|
||||
return this.q.enqueue(function(){
|
||||
var location = this.currentLocation();
|
||||
this.trigger("locationChanged", location);
|
||||
this.location = this.currentLocation();
|
||||
this.trigger("locationChanged", this.location);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.currentLocation = function(){
|
||||
var visible = this.visible();
|
||||
var startA, startB, endA, endB;
|
||||
|
||||
container = this.container.getBoundingClientRect()
|
||||
var pageLeft, pageRight;
|
||||
var container = this.container.getBoundingClientRect()
|
||||
|
||||
if(visible.length === 1) {
|
||||
startA = container.left - visible[0].position().left;
|
||||
|
@ -211,6 +218,33 @@ EPUBJS.Paginate.prototype.currentLocation = function(){
|
|||
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.resize = function(width, height){
|
||||
// Clear the queue
|
||||
this.q.clear();
|
||||
|
||||
this.stageSize(width, height);
|
||||
|
||||
this.layoutUpdate();
|
||||
|
||||
this.display(this.location.start);
|
||||
|
||||
this.trigger("resized", {
|
||||
width: this.stage.width,
|
||||
height: this.stage.height
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.onResized = function(e) {
|
||||
|
||||
this.clear();
|
||||
|
||||
clearTimeout(this.resizeTimeout);
|
||||
this.resizeTimeout = setTimeout(function(){
|
||||
this.resize();
|
||||
}.bind(this), 150);
|
||||
};
|
||||
|
||||
// EPUBJS.Paginate.prototype.display = function(what){
|
||||
// return this.display(what);
|
||||
// };
|
Loading…
Add table
Add a link
Reference in a new issue