1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Merge pull request #959 from sengemann/master

Adding epubcif as an optional paramater to the Rendition.resize() method
This commit is contained in:
Fred Chasen 2019-08-07 21:29:43 -07:00 committed by GitHub
commit 94edd48092
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3301 additions and 3299 deletions

6584
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -189,7 +189,7 @@ class DefaultViewManager {
this.resize();
}
resize(width, height){
resize(width, height, epubcfi){
let stageSize = this.stage.size(width, height);
// For Safari, wait for orientation to catch up
@ -225,7 +225,7 @@ class DefaultViewManager {
this.emit(EVENTS.MANAGERS.RESIZED, {
width: this._stageSize.width,
height: this._stageSize.height
});
}, epubcfi);
}
createView(section) {

View file

@ -446,22 +446,23 @@ class Rendition {
* Report resize events and display the last seen location
* @private
*/
onResized(size){
onResized(size, epubcfi){
/**
* Emit that the rendition has been resized
* @event resized
* @param {number} width
* @param {height} height
* @param {string} epubcfi (optional)
* @memberof Rendition
*/
this.emit(EVENTS.RENDITION.RESIZED, {
width: size.width,
height: size.height
});
}, epubcfi);
if (this.location && this.location.start) {
this.display(this.location.start.cfi);
this.display(epubcfi || this.location.start.cfi);
}
}
@ -493,15 +494,16 @@ class Rendition {
* Trigger a resize of the views
* @param {number} [width]
* @param {number} [height]
* @param {string} [epubcfi] (optional)
*/
resize(width, height){
resize(width, height, epubcfi){
if (width) {
this.settings.width = width;
}
if (height) {
this.settings.height = height;
}
this.manager.resize(width, height);
this.manager.resize(width, height, epubcfi);
}
/**