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

Update axis to support vertical writing mode

This commit is contained in:
Fred Chasen 2017-10-27 16:47:16 -07:00
parent eb2c57f07b
commit 101cd47513
5 changed files with 126 additions and 36 deletions

View file

@ -150,6 +150,13 @@ class IframeView {
// apply the layout function to the contents
this.settings.layout.format(this.contents);
// find and report the writingMode axis
let writingMode = this.contents.writingMode();
let axis = (writingMode.indexOf("vertical") === 0) ? "vertical" : "horizontal";
this.setAxis(axis);
this.emit("axis", axis);
// Listen for events that require an expansion of the iframe
this.addListeners();
@ -195,6 +202,9 @@ class IframeView {
} else {
this.lock("width", width, height);
}
this.settings.width = width;
this.settings.height = height;
}
// Lock an axis to element dimensions, taking borders into account
@ -405,6 +415,7 @@ class IframeView {
setAxis(axis) {
this.settings.axis = axis;
this.size();
}
addListeners() {