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

Add layout event and forceEvenPages for default manager

This commit is contained in:
Fred Chasen 2017-11-08 19:27:58 -08:00
parent 8c22080a86
commit 46800b05b6
8 changed files with 1568 additions and 264 deletions

View file

@ -478,6 +478,28 @@ class Rendition {
this.manager.moveTo(offset);
}
/**
* Trigger a resize of the views
* @param {number} [width]
* @param {number} [height]
*/
resize(width, height){
if (width) {
this.settings.width = width;
}
if (height) {
this.settings.height = width;
}
this.manager.resize(width, height);
}
/**
* Clear all rendered views
*/
clear(){
this.manager.clear();
}
/**
* Go to the next "page" in the rendition
* @return {Promise}
@ -578,6 +600,11 @@ class Rendition {
this._layout.spread(settings.spread, this.settings.minSpreadWidth);
// this.mapping = new Mapping(this._layout.props);
this._layout.on(EVENTS.LAYOUT.UPDATED, (props, changed) => {
console.log("layout", props);
this.emit(EVENTS.RENDITION.LAYOUT, props);
})
}
if (this.manager && this._layout) {