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

Add direction to Layout

This commit is contained in:
Fred Chasen 2017-10-17 11:50:18 -07:00
parent 9b6e864ae4
commit a42f758559
6 changed files with 10 additions and 19 deletions

View file

@ -46,7 +46,7 @@
// height: "100vh",
overflow: "visible",
manager: "continuous",
flow: "paginated"
// flow: "paginated"
});
rendition.display(currentCfi || currentSectionIndex);

View file

@ -764,7 +764,7 @@ class Contents {
var COLUMN_WIDTH = prefixed("column-width");
var COLUMN_FILL = prefixed("column-fill");
this.width("100%");
this.width(width);
this.height(height);
// Deal with Mobile trying to scale to viewport

View file

@ -171,6 +171,10 @@ class Layout {
format(contents){
var formating;
if (this.settings.direction) {
contents.direction(this.settings.direction);
}
if (this.name === "pre-paginated") {
formating = contents.fit(this.columnWidth, this.height);
} else if (this._flow === "paginated") {

View file

@ -258,16 +258,6 @@ class DefaultViewManager {
this.add(section)
.then(function(view){
// if (this.settings.direction === "rtl") {
// let offset = view.offset();
// let width = view.width();
//
// this.moveTo({
// left: offset.left + width,
// top: offset.top
// });
// }
// Move to correct place within the section, if needed
if(target) {
let offset = view.locationOf(target);
@ -309,10 +299,6 @@ class DefaultViewManager {
this.emit("resize", view.section);
}
// moveTo(offset){
// this.scrollTo(offset.left, offset.top);
// };
moveTo(offset){
var distX = 0,
distY = 0;
@ -501,7 +487,6 @@ class DefaultViewManager {
if (this.settings.direction === "rtl") {
this.scrollTo(0, 0, true);
} else {
console.log(this.container.scrollWidth);
this.scrollTo(this.container.scrollWidth - this.layout.delta, 0, true);
}
}

View file

@ -9,7 +9,7 @@ class IframeView {
this.settings = extend({
ignoreClass : "",
axis: "vertical",
direction: "ltr",
direction: undefined,
width: 0,
height: 0,
layout: undefined,

View file

@ -427,6 +427,7 @@ class Rendition {
var flow = this.settings.flow || metadata.flow || "auto";
var viewport = metadata.viewport || "";
var minSpreadWidth = this.settings.minSpreadWidth || metadata.minSpreadWidth || 800;
var direction = this.settings.direction || metadata.direction || "ltr";
if ((this.settings.width === 0 || this.settings.width > 0) &&
(this.settings.height === 0 || this.settings.height > 0)) {
@ -439,7 +440,8 @@ class Rendition {
orientation : orientation,
flow : flow,
viewport : viewport,
minSpreadWidth : minSpreadWidth
minSpreadWidth : minSpreadWidth,
direction: direction
};
return properties;