1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Set layout variables as props for passing as json

This commit is contained in:
Fred Chasen 2017-03-31 13:36:48 -04:00
parent a1ffc44efa
commit 9e18040c53
7 changed files with 49 additions and 14 deletions

View file

@ -9,6 +9,7 @@
*/
class Layout {
constructor(settings) {
this.settings = settings;
this.name = settings.layout || "reflowable";
this._spread = (settings.spread === "none") ? false : true;
this._minSpreadWidth = settings.minSpreadWidth || 800;
@ -30,6 +31,20 @@ class Layout {
this.columnWidth = 0;
this.gap = 0;
this.divisor = 1;
this.props = {
name: this.name,
spread: this._spread,
flow: this._flow,
width: 0,
height: 0,
spreadWidth: 0,
delta: 0,
columnWidth: 0,
gap: 0,
divisor: 1
};
}
/**
@ -44,6 +59,7 @@ class Layout {
} else {
this._flow = "paginated";
}
this.props.flow = this._flow;
}
return this._flow;
}
@ -56,11 +72,16 @@ class Layout {
*/
spread(spread, min) {
this._spread = (spread === "none") ? false : true;
if (spread) {
this._spread = (spread === "none") ? false : true;
this.props.spread = this._spread;
}
if (min >= 0) {
this._minSpreadWidth = min;
}
return this._spread;
}
/**
@ -121,6 +142,15 @@ class Layout {
this.columnWidth = colWidth;
this.gap = gap;
this.divisor = divisor;
this.props.width = width;
this.props.height = _height;
this.props.spreadWidth = spreadWidth;
this.props.delta = delta;
this.props.columnWidth = colWidth;
this.props.gap = gap;
this.props.divisor = divisor;
}
/**