1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-02 14:49:16 +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", // height: "100vh",
overflow: "visible", overflow: "visible",
manager: "continuous", manager: "continuous",
flow: "paginated" // flow: "paginated"
}); });
rendition.display(currentCfi || currentSectionIndex); rendition.display(currentCfi || currentSectionIndex);

View file

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

View file

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

View file

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

View file

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

View file

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