From bcb93ed3091c691c26cb73d14a56571401474437 Mon Sep 17 00:00:00 2001 From: Johan Poirier Date: Wed, 3 Sep 2014 15:56:38 +0200 Subject: [PATCH 01/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fdb9e0ad..b11e32818 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ readium-shared-js ================= -Repository for the shared JavaScript libraries that are used in the SDK-Launchers and other applications developed on top of the SDK +Repository for the shared JavaScript libraries that are used in the SDK-Launchers and other applications developed on top of the SDK. From 7211ddc3b8f1d133c51303874b0a617be929a937 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 23 Oct 2014 12:33:41 +0100 Subject: [PATCH 02/11] css prefixes should be handled by jQuery (need to double-check transform *value* in transition *property*) --- js/helpers.js | 7 ++---- js/views/fixed_view.js | 6 ++--- js/views/one_page_view.js | 50 +++++++------------------------------ js/views/reflowable_view.js | 22 ++++++---------- 4 files changed, 20 insertions(+), 65 deletions(-) diff --git a/js/helpers.js b/js/helpers.js index afa626dab..fd4aaf7e7 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -441,11 +441,8 @@ ReadiumSDK.Helpers.CSSTransformString = function(options) { } var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + 'transform'] = transformString; - css[prefix + 'transform-origin'] = origin ? origin : (enable3D ? '0 0 0' : '0 0'); - }); - + css['transform'] = transformString; + css['transform-origin'] = origin ? origin : (enable3D ? '0 0 0' : '0 0'); return css; }; diff --git a/js/views/fixed_view.js b/js/views/fixed_view.js index 5711310bd..d9c65b64a 100644 --- a/js/views/fixed_view.js +++ b/js/views/fixed_view.js @@ -90,10 +90,8 @@ ReadiumSDK.Views.FixedView = function(options, reader){ var template = ReadiumSDK.Helpers.loadTemplate("fixed_book_frame", {}); _$el = $(template); - - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - _$el.css(prefix + "transition", "all 0 ease 0"); - }); + + _$el.css("transition", "all 0 ease 0"); _$el.css("overflow", "hidden"); diff --git a/js/views/one_page_view.js b/js/views/one_page_view.js index 862a61876..0d13e01a6 100644 --- a/js/views/one_page_view.js +++ b/js/views/one_page_view.js @@ -66,12 +66,8 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid function(scale, left, top, $el, meta_width, meta_height, pageSwitchDir) { $el.css("transform", "none"); - - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = "opacity 150ms ease-out"; - }); - $el.css(css); + + $el.css("transition", "opacity 150ms ease-out"); $el.css("opacity", "1"); } @@ -92,14 +88,8 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = prefix + "transform 150ms ease-out"; - }); - $el.css(css); + $el.css("transition", "transform 150ms ease-out"); - //$el.css("-webkit-transition", "-webkit-transform 200ms ease-out"); - $el.css("transform", "none"); } ); @@ -119,13 +109,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = prefix + "transform 300ms ease-in-out"; - }); - $el.css(css); - - //$el.css("-webkit-transition", "-webkit-transform 200ms ease-out"); + $el.css("transition", "transform 300ms ease-in-out"); $el.css("transform", "none"); } @@ -170,14 +154,8 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = prefix + "transform 400ms ease-out"; - }); - $el.css(css); + $el.css("transition", "transform 400ms ease-out"); - //$el.css("-webkit-transition", "-webkit-transform 200ms ease-out"); - $el.css("transform", "none"); } ); @@ -245,11 +223,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid if (_disablePageTransitions || _pageTransition === -1) return; - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { // NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = "all 0 ease 0"; - }); - $el.css(css); + $el.css("transition", "all 0 ease 0"); if (!pageSwitchActuallyChanged) return; @@ -281,11 +255,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("transform", "none"); - var css = {}; - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - css[prefix + "transition"] = "opacity 250ms linear"; - }); - $el.css(css); + $el.css("transition", "opacity 250ms linear"); $el.css("opacity", "1"); } @@ -332,10 +302,8 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid _$el = $(template); _$scaler = $("#scaler", _$el); - - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - _$el.css(prefix + "transition", "all 0 ease 0"); - }); + + _$el.css("transition", "all 0 ease 0"); _$el.css("transform", "none"); diff --git a/js/views/reflowable_view.js b/js/views/reflowable_view.js index b21073b7f..7009a3ec5 100644 --- a/js/views/reflowable_view.js +++ b/js/views/reflowable_view.js @@ -202,10 +202,8 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ function updateColumnGap() { if(_$epubHtml) { - - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - _$epubHtml.css(prefix + "column-gap", _paginationInfo.columnGap + "px"); - }); + + _$epubHtml.css("column-gap", _paginationInfo.columnGap + "px"); } } @@ -292,19 +290,15 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ _$epubHtml.css("margin", "0"); _$epubHtml.css("padding", "0"); - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - _$epubHtml.css(prefix + "column-axis", (_htmlBodyIsVerticalWritingMode ? "vertical" : "horizontal")); - }); + _$epubHtml.css("column-axis", (_htmlBodyIsVerticalWritingMode ? "vertical" : "horizontal")); // // ///////// // //Columns Debugging // - // _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - // _$epubHtml.css(prefix + "column-rule-color", "red"); - // _$epubHtml.css(prefix + "column-rule-style", "dashed"); - // _$epubHtml.css(prefix + "column-rule-width", "1px"); - // }); + // _$epubHtml.css("column-rule-color", "red"); + // _$epubHtml.css("column-rule-style", "dashed"); + // _$epubHtml.css("column-rule-width", "1px"); // _$epubHtml.css("background-color", '#b0c4de'); // // //// @@ -630,9 +624,7 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ _$epubHtml.css("width", (_htmlBodyIsVerticalWritingMode ? _lastViewPortSize.width : _paginationInfo.columnWidth) + "px"); - _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) {// NOTE THAT empty '' must be the FIRST prefix!! - _$epubHtml.css(prefix + "column-width", _paginationInfo.columnWidth + "px"); - }); + _$epubHtml.css("column-width", _paginationInfo.columnWidth + "px"); _$epubHtml.css({left: "0", right: "0", top: "0"}); From 7df4a219167a885048d02b761ce49d2803dda3f8 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 23 Oct 2014 13:13:15 +0100 Subject: [PATCH 03/11] ah, transitions must be treated separately, CSS prefix for value as well as property. --- js/helpers.js | 9 +++++++++ js/views/fixed_view.js | 2 +- js/views/one_page_view.js | 14 +++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/js/helpers.js b/js/helpers.js index fd4aaf7e7..f3ee9454e 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -409,6 +409,15 @@ ReadiumSDK.Helpers.isRenditionSpreadPermittedForItem = function(item, orientatio && orientation == ReadiumSDK.Views.ORIENTATION_PORTRAIT ); }; +ReadiumSDK.Helpers.CSSTransition = function($el, trans) { + var css={}; + // Note that empty '' MUST be the first prefix! + _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { + css[prefix + 'transition'] = prefix + trans; + }); + $el.css(css); +} + //scale, left, top, angle, origin ReadiumSDK.Helpers.CSSTransformString = function(options) { var enable3D = options.enable3D ? true : false; diff --git a/js/views/fixed_view.js b/js/views/fixed_view.js index d9c65b64a..0d1022e41 100644 --- a/js/views/fixed_view.js +++ b/js/views/fixed_view.js @@ -91,7 +91,7 @@ ReadiumSDK.Views.FixedView = function(options, reader){ _$el = $(template); - _$el.css("transition", "all 0 ease 0"); + ReadiumSDK.Helpers.CSSTransition(_$el, "all 0 ease 0"); _$el.css("overflow", "hidden"); diff --git a/js/views/one_page_view.js b/js/views/one_page_view.js index 0d13e01a6..9f56c6122 100644 --- a/js/views/one_page_view.js +++ b/js/views/one_page_view.js @@ -67,7 +67,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("transform", "none"); - $el.css("transition", "opacity 150ms ease-out"); + ReadiumSDK.Helpers.CSSTransition($el, "opacity 150ms ease-out"); $el.css("opacity", "1"); } @@ -88,7 +88,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - $el.css("transition", "transform 150ms ease-out"); + ReadiumSDK.Helpers.CSSTransition($el, "transform 150ms ease-out"); $el.css("transform", "none"); } @@ -109,7 +109,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - $el.css("transition", "transform 300ms ease-in-out"); + ReadiumSDK.Helpers.CSSTransition($el, "transform 300ms ease-in-out"); $el.css("transform", "none"); } @@ -154,7 +154,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("opacity", "1"); - $el.css("transition", "transform 400ms ease-out"); + ReadiumSDK.Helpers.CSSTransition($el, "transform 400ms ease-out"); $el.css("transform", "none"); } @@ -223,7 +223,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid if (_disablePageTransitions || _pageTransition === -1) return; - $el.css("transition", "all 0 ease 0"); + ReadiumSDK.Helpers.CSSTransition($el, "all 0 ease 0"); if (!pageSwitchActuallyChanged) return; @@ -255,7 +255,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid { $el.css("transform", "none"); - $el.css("transition", "opacity 250ms linear"); + ReadiumSDK.Helpers.CSSTransition($el, "opacity 250ms linear"); $el.css("opacity", "1"); } @@ -303,7 +303,7 @@ ReadiumSDK.Views.OnePageView = function(options, classes, enableBookStyleOverrid _$scaler = $("#scaler", _$el); - _$el.css("transition", "all 0 ease 0"); + ReadiumSDK.Helpers.CSSTransition(_$el, "all 0 ease 0"); _$el.css("transform", "none"); From 2de2a08da459f3e43f007834de867bc3c6ff2e64 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 23 Oct 2014 13:28:37 +0100 Subject: [PATCH 04/11] minor comment --- js/helpers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/helpers.js b/js/helpers.js index f3ee9454e..539fc5f14 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -410,8 +410,12 @@ ReadiumSDK.Helpers.isRenditionSpreadPermittedForItem = function(item, orientatio }; ReadiumSDK.Helpers.CSSTransition = function($el, trans) { + + // does not work! + //$el.css('transition', trans); + var css={}; - // Note that empty '' MUST be the first prefix! + // empty '' prefix FIRST! _.each(['', '-webkit-', '-moz-', '-ms-'], function(prefix) { css[prefix + 'transition'] = prefix + trans; }); From e64be6287a00c34a036a4ae386cc47548578623c Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 23 Oct 2014 23:17:31 +0100 Subject: [PATCH 05/11] overflow should only be enabled for fixed-layout pan-zoom, not reflow or scroll views. Fixes https://github.com/readium/readium-js-viewer/issues/232 (fixes Chrome extension/cloud reader, as well as native apps (although they do not expose "zoom" UI affordances yet)) (trivial tested fix, no need for feature branch + pull request) --- js/views/fixed_view.js | 7 ++++++- js/views/reader_view.js | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/js/views/fixed_view.js b/js/views/fixed_view.js index 0d1022e41..cfbf67786 100644 --- a/js/views/fixed_view.js +++ b/js/views/fixed_view.js @@ -313,7 +313,9 @@ ReadiumSDK.Views.FixedView = function(options, reader){ var horScale = potentialContentSize.width / _contentMetaSize.width; var verScale = potentialContentSize.height / _contentMetaSize.height; - + + _$viewport.css("overflow", "auto"); + var scale; if (_zoom.style == 'fit-width'){ scale = horScale; @@ -326,6 +328,9 @@ ReadiumSDK.Views.FixedView = function(options, reader){ } else{ scale = Math.min(horScale, verScale); + + // no need for pan during "viewport fit" zoom + _$viewport.css("overflow", "hidden"); } _currentScale = scale; diff --git a/js/views/reader_view.js b/js/views/reader_view.js index 482ee8644..ec49f7a6b 100644 --- a/js/views/reader_view.js +++ b/js/views/reader_view.js @@ -80,8 +80,15 @@ ReadiumSDK.Views.ReaderView = function(options) { this.createViewForType = function(viewType, options) { var createdView; + + // NOTE: _$el == options.$viewport + _$el.css("overflow", "hidden"); + switch(viewType) { case ReadiumSDK.Views.ReaderView.VIEW_TYPE_FIXED: + + _$el.css("overflow", "auto"); // for content pan, see self.setZoom() + createdView = new ReadiumSDK.Views.FixedView(options, self); break; case ReadiumSDK.Views.ReaderView.VIEW_TYPE_SCROLLED_DOC: From cab6a21419bc7d2c472c4e43db5548b92698ff36 Mon Sep 17 00:00:00 2001 From: Juan Corona Date: Wed, 29 Oct 2014 17:38:30 -0700 Subject: [PATCH 06/11] Remove incorrect spine item check based on a page index. --- js/views/reader_view.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/js/views/reader_view.js b/js/views/reader_view.js index ec49f7a6b..d969eaf02 100644 --- a/js/views/reader_view.js +++ b/js/views/reader_view.js @@ -614,11 +614,6 @@ ReadiumSDK.Views.ReaderView = function(options) { } var pageRequest; - var spineItem = _spine.items[pageIndex]; - if(!spineItem) { - return false; - } - if(_package.isFixedLayout()) { var spineItem = _spine.items[pageIndex]; From 09cccf30a536137eda9b4f2e150af0e10b3413a2 Mon Sep 17 00:00:00 2001 From: Ric Wright Date: Mon, 3 Nov 2014 09:04:20 -0600 Subject: [PATCH 07/11] Added BSD-style license file license.txt to the root of the repo. --- license.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 license.txt diff --git a/license.txt b/license.txt new file mode 100644 index 000000000..34abbdc0d --- /dev/null +++ b/license.txt @@ -0,0 +1,8 @@ +Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 1f5dea0eb023676e414c8ef8e366fd70c2249158 Mon Sep 17 00:00:00 2001 From: Johan Poirier Date: Thu, 13 Nov 2014 11:32:20 +0100 Subject: [PATCH 08/11] Update README.md Added info about where to find information about the licensing. Conflicts: README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b11e32818..a27ec2181 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ readium-shared-js ================= -Repository for the shared JavaScript libraries that are used in the SDK-Launchers and other applications developed on top of the SDK. +Repository for the shared JavaScript libraries that are used in the SDK-Launchers and other applications developed on top of the SDK + +Licensing info +---------------- +Licensing information can be found in the file license.txt in the root of the repo, as well as in the source code itself. \ No newline at end of file From 195709b9eb71289cb3257ed288b2352e26e75b34 Mon Sep 17 00:00:00 2001 From: danielweck Date: Tue, 10 Mar 2015 14:10:02 +0000 Subject: [PATCH 09/11] Fixes dual mouse / touch support in Windows8 (WebKit/Chromium -based browsers), see https://github.com/readium/readium-shared-js/issues/165 --- js/views/media_overlay_data_injector.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/views/media_overlay_data_injector.js b/js/views/media_overlay_data_injector.js index 955bb706f..51e0c5027 100644 --- a/js/views/media_overlay_data_injector.js +++ b/js/views/media_overlay_data_injector.js @@ -50,9 +50,10 @@ ReadiumSDK.Views.MediaOverlayDataInjector = function (mediaOverlay, mediaOverlay else { $body.data("mediaOverlayClick", {ping: "pong"}); - var clickEvent = 'ontouchstart' in document.documentElement ? 'touchstart' : 'click'; - $body.bind(clickEvent, function (event) + var touchClickMOEventHandler = function (event) { + //console.debug("MO TOUCH-DOWN: "+event.type); + var elem = $(this)[0]; // body elem = event.target; // body descendant @@ -261,7 +262,18 @@ console.debug("MO readaloud attr: " + readaloud); mediaOverlayPlayer.touchInit(); return true; - }); + }; + + var touchClickMOEventHandler_ = _.debounce(touchClickMOEventHandler, 200); + + if ('ontouchstart' in document.documentElement) + { + $body[0].addEventListener("touchstart", touchClickMOEventHandler_, false); + } + $body[0].addEventListener("mousedown", touchClickMOEventHandler_, false); + + //var clickEvent = 'ontouchstart' in document.documentElement ? 'touchstart' : 'click'; + //$body.bind(clickEvent, touchClickMOEventHandler); } } From bf04a87de9fc91ef43332933bcdfd13b51f6880e Mon Sep 17 00:00:00 2001 From: Johan Poirier Date: Wed, 10 Jun 2015 10:05:54 +0200 Subject: [PATCH 10/11] Do not round column width value: it causes wrong value of page offset --- README.md | 1 - js/views/reflowable_view.js | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 77ecfaddc..bc279e5e5 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,4 @@ Repository for the shared JavaScript libraries that are used in the SDK-Launcher Licensing info ---------------- - Licensing information can be found in the file license.txt in the root of the repo, as well as in the source code itself. diff --git a/js/views/reflowable_view.js b/js/views/reflowable_view.js index 014fd2760..3551d1ffb 100644 --- a/js/views/reflowable_view.js +++ b/js/views/reflowable_view.js @@ -452,9 +452,8 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ } function onPaginationChanged(initiator, paginationRequest_spineItem, paginationRequest_elementId) { + _paginationInfo.pageOffset = Math.round((_paginationInfo.columnWidth + _paginationInfo.columnGap) * _paginationInfo.visibleColumnCount * _paginationInfo.currentSpreadIndex); - _paginationInfo.pageOffset = (_paginationInfo.columnWidth + _paginationInfo.columnGap) * _paginationInfo.visibleColumnCount * _paginationInfo.currentSpreadIndex; - redraw(); self.trigger(ReadiumSDK.InternalEvents.CURRENT_VIEW_PAGINATION_CHANGED, { paginationInfo: self.getPaginationInfo(), initiator: initiator, spineItem: paginationRequest_spineItem, elementId: paginationRequest_elementId } ); } @@ -620,7 +619,7 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ _paginationInfo.rightToLeft = _spine.isRightToLeft(); - _paginationInfo.columnWidth = Math.round(((_htmlBodyIsVerticalWritingMode ? _lastViewPortSize.height : _lastViewPortSize.width) - _paginationInfo.columnGap * (_paginationInfo.visibleColumnCount - 1)) / _paginationInfo.visibleColumnCount); + _paginationInfo.columnWidth = ((_htmlBodyIsVerticalWritingMode ? _lastViewPortSize.height : _lastViewPortSize.width) - _paginationInfo.columnGap * (_paginationInfo.visibleColumnCount - 1)) / _paginationInfo.visibleColumnCount; var useColumnCountNotWidth = _paginationInfo.visibleColumnCount > 1; // column-count == 1 does not work in Chrome, and is not needed anyway (HTML width is full viewport width, no Firefox video flickering) if (useColumnCountNotWidth) { @@ -642,14 +641,13 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ var totalGaps = (_paginationInfo.columnCount-1) * _paginationInfo.columnGap; var colWidthCheck = ((_htmlBodyIsVerticalWritingMode ? _$epubHtml[0].scrollHeight : _$epubHtml[0].scrollWidth) - totalGaps) / _paginationInfo.columnCount; - colWidthCheck = Math.round(colWidthCheck); if (colWidthCheck > _paginationInfo.columnWidth) { console.debug("ADJUST COLUMN"); console.log(_paginationInfo.columnWidth); console.log(colWidthCheck); - + _paginationInfo.columnWidth = colWidthCheck; } From 3be5f0414a6c713a967ab5941674dd96032b440c Mon Sep 17 00:00:00 2001 From: Johan Poirier Date: Wed, 17 Jun 2015 15:44:23 +0200 Subject: [PATCH 11/11] Fix: round column width value for css --- js/views/reflowable_view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/views/reflowable_view.js b/js/views/reflowable_view.js index 3551d1ffb..12b7070f9 100644 --- a/js/views/reflowable_view.js +++ b/js/views/reflowable_view.js @@ -626,8 +626,8 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){ _$epubHtml.css("width", _lastViewPortSize.width + "px"); _$epubHtml.css("column-count", _paginationInfo.visibleColumnCount); } else { - _$epubHtml.css("width", (_htmlBodyIsVerticalWritingMode ? _lastViewPortSize.width : _paginationInfo.columnWidth) + "px"); - _$epubHtml.css("column-width", _paginationInfo.columnWidth + "px"); + _$epubHtml.css("width", (_htmlBodyIsVerticalWritingMode ? _lastViewPortSize.width : Math.round(_paginationInfo.columnWidth)) + "px"); + _$epubHtml.css("column-width", Math.round(_paginationInfo.columnWidth) + "px"); } _$epubHtml.css("column-fill", "auto");