mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Updated Expands and Layout methods
This commit is contained in:
parent
6b25126f00
commit
b88aab25d9
14 changed files with 1116 additions and 766 deletions
|
@ -88,4 +88,34 @@ EPUBJS.Section.prototype.render = function(_request){
|
|||
|
||||
EPUBJS.Section.prototype.find = function(_query){
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Reconciles the current chapters layout properies with
|
||||
* the global layout properities.
|
||||
* Takes: global layout settings object, chapter properties string
|
||||
* Returns: Object with layout properties
|
||||
*/
|
||||
EPUBJS.Section.prototype.reconcileLayoutSettings = function(global){
|
||||
//-- Get the global defaults
|
||||
var settings = {
|
||||
layout : global.layout,
|
||||
spread : global.spread,
|
||||
orientation : global.orientation
|
||||
};
|
||||
|
||||
//-- Get the chapter's display type
|
||||
this.properties.forEach(function(prop){
|
||||
var rendition = prop.replace("rendition:", '');
|
||||
var split = rendition.indexOf("-");
|
||||
var property, value;
|
||||
|
||||
if(split != -1){
|
||||
property = rendition.slice(0, split);
|
||||
value = rendition.slice(split+1);
|
||||
|
||||
settings[property] = value;
|
||||
}
|
||||
});
|
||||
return settings;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue