joseph/Monocle — Issue #96: Issues with places after skipToChapter?
Author: joaosantos81
Created: 2012-03-06 18:29:29+00:00
State: open

Hi,

I have beeing doing some tests to Monocle version 2.3.1 and I found a strange behavior getting current page after skipting to a chapter and then start navigating (to previous or next pages). To repro this issue, I added the page place (top and bottom percentage) to console log.

reader.listen(
'monocle:pagechange',
function (evt) {
var place = reader.getPlace(evt.m.page);
var section = place.componentId();
var pageTopPos = place.percentAtTopOfPage();
var pageBottomPos = place.percentAtBottomOfPage();
console.log("Page-change. Section: " + section + "; topPos=" + pageTopPos + "; BottomPos=" + pageBottomPos);
}

The repro steps are these ones:
1- Open a book (instance: showcase/02-dickens)
2- Click in current chapter name to open the Table of Contents menu (ex: Chapter II)
3- Swipe to go to next page
4- Swipe to go to back page (to the beginning of Chapter II)

** Expected result:**
The top position of next page should be equal to the bottom of current one. However, they are different.

Let me show some values.

# Normal pagination in the book (without using skipToChapter or moveTo functions)

Page-change. Section: components/2.html; topPos=0.6354166666666667; BottomPos=0.6458333333333334
Page-change. Section: components/2.html; topPos=0.6458333333333334; BottomPos=0.65625
Page-change. Section: components/2.html; topPos=0.65625; BottomPos=0.6666666666666666
Page-change. Section: components/2.html; topPos=0.6666666666666667; BottomPos=0.6770833333333334
Page-change. Section: components/2.html; topPos=0.6770833333333334; BottomPos=0.6875
Page-change. Section: components/2.html; topPos=0.6875; BottomPos=0.6979166666666666

The bottomPos of a page is equal to the topPos of next page

*****************************************************

# Behavior when with TOC menu click (uses skipToChapter method)

1) Go to Chapter 2
Page-change. Section: components/2.html; topPos=0.6145833333333334; BottomPos=0.625
Page-change. Section: components/2.html; topPos=0.625; BottomPos=0.6354166666666666

** Note sure why there are 2 page transitions... **

2) Swiping Next page
Page-change. Section: components/2.html; topPos=0.6275862068965518; BottomPos=0.6344827586206897

3) Then swiping back page
Page-change. Section: components/2.html; topPos=0.6137931034482759; BottomPos=0.6206896551724138

** Note that bottom pos (0.62) is different from the top position of previous page (0.634) **

Am I doing something wrong? There's any work around?

Thanks