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

fixed column width bug

This commit is contained in:
fchasen 2014-02-16 16:33:03 -08:00
parent 02a9a4b566
commit a6815c0398
10 changed files with 154 additions and 25 deletions

View file

@ -65,22 +65,21 @@ EPUBJS.Layout.ReflowableSpreads.prototype.format = function(documentElement, _wi
cutoff = 800;
//-- Check the width and create even width columns
var width = (_width % 2 === 0) ? _width : Math.floor(_width) - 1;
var section = Math.ceil(width / 8);
var fullWidth = Math.floor(_width);
var width = (fullWidth % 2 === 0) ? fullWidth : fullWidth - 1;
var section = Math.floor(width / 8);
var gap = (section % 2 === 0) ? section : section - 1;
//-- Double Page
var colWidth = Math.floor((width - gap) / divisor);
this.documentElement = documentElement;
this.spreadWidth = (colWidth + gap) * divisor;
documentElement.style.width = "auto"; //-- reset width for calculations
documentElement.style.overflow = "hidden";
//documentElement.style.width = width + "px";
// Must be set to the new calculated width or the columns will be off
documentElement.style.width = width + "px";
//-- Adjust height
documentElement.style.height = _height + "px";