Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bcb93ed
Update README.md
johanpoirier Sep 3, 2014
1ad833a
Merge branch 'develop' of github.com:TEA-ebook/readium-shared-js into…
johanpoirier Sep 17, 2014
5bbd42b
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Oct 3, 2014
5db0768
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Oct 22, 2014
7211ddc
css prefixes should be handled by jQuery (need to double-check transf…
danielweck Oct 23, 2014
7df4a21
ah, transitions must be treated separately, CSS prefix for value as w…
danielweck Oct 23, 2014
2de2a08
minor comment
danielweck Oct 23, 2014
8b22b4d
Merge pull request #137 from readium/feature/cssPrefixes
danielweck Oct 23, 2014
e64be62
overflow should only be enabled for fixed-layout pan-zoom, not reflow…
danielweck Oct 23, 2014
cab6a21
Remove incorrect spine item check based on a page index.
jccr Oct 30, 2014
09cccf3
Added BSD-style license file license.txt to the root of the repo.
rkwright Nov 3, 2014
1f5dea0
Update README.md
johanpoirier Nov 13, 2014
c3fac9f
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Nov 13, 2014
3158be7
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Feb 23, 2015
1212f7a
Merge branch 'master' into release/0.17
rkwright Mar 20, 2015
195709b
Fixes dual mouse / touch support in Windows8 (WebKit/Chromium -based …
danielweck Mar 10, 2015
e4af415
Merge branch 'release/0.17' into develop
rkwright Mar 20, 2015
6503cd2
Merge branch 'develop' of https://github.com/readium/readium-shared-j…
rkwright Mar 20, 2015
6404ef4
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Mar 24, 2015
6554b88
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier May 5, 2015
a60583e
Merge remote-tracking branch 'readium/develop' into develop
johanpoirier Jun 10, 2015
bf04a87
Do not round column width value: it causes wrong value of page offset
johanpoirier Jun 10, 2015
3be5f04
Fix: round column width value for css
johanpoirier Jun 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions js/views/reflowable_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I like the idea of deferring the numerical rounding until the last minute (i.e. application of CSS rules), I am concerned that / curious about the fact that _paginationInfo.pageOffset potentially contains many decimal places, and is used in the "CFI navigation logic" calculations:
https://github.com/readium/readium-shared-js/blob/develop/js/views/cfi_navigation_logic.js#L116

    function getVisibleContentOffsets() {
        if(isVerticalWritingMode()){
            return {
                top: (options.paginationInfo ? options.paginationInfo.pageOffset : 0)
            };
        }
        return {
            left: (options.paginationInfo ? options.paginationInfo.pageOffset : 0)
                * (isPageProgressionRightToLeft() ? -1 : 1)
        };
    }

_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 } );
}
Expand Down Expand Up @@ -620,15 +619,15 @@ 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reasons as above _paginationInfo.pageOffset, I want to make sure we do not introduce regression bugs in the "CFI navigation logic" calculations because of non-rounded _paginationInfo.columnWidth:
https://github.com/readium/readium-shared-js/blob/develop/js/views/cfi_navigation_logic.js#L98

    function getColumnFullWidth() {

        if (!options.paginationInfo || isVerticalWritingMode())
        {
            return $iframe.width();
        }

        return options.paginationInfo.columnWidth + options.paginationInfo.columnGap;
    }


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) {
_$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");
Expand All @@ -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;
}

Expand Down