Fix ScrollView get first/last visible CFI by calculating the right visibleContentOffsets & frameDimensions
MODIFY
js/views/scroll_view.js
js/views/scroll_view.js
@@ -1357,18 +1357,15 @@ var ScrollView = function (options, isContinuousScroll, reader) {
var pageViewTopOffset =selectedPageView.element().position().top;
var visibleContentOffsets, frameDimensions;
- var setupFunctions = [
- function () {
visibleContentOffsets = {
- top: pageViewTopOffset,
+ top: Math.min(0, pageViewTopOffset),
left: 0
};
- },
- function() {
- var height = selectedPageView.element().height();
+
+ var height = Math.min(selectedPageView.element().height(), viewHeight());
if (pageViewTopOffset >= 0) {
- height = viewHeight() - pageViewTopOffset;
+ height = height - pageViewTopOffset;
}
frameDimensions = {
@@ -1376,16 +1373,6 @@ var ScrollView = function (options, isContinuousScroll, reader) {
height: height
};
- visibleContentOffsets = {
- top: 0,
- left: 0
- };
- }
- ];
-
- //invoke setup function
- pickerFunc(setupFunctions)();
-
var cfiFunctions = [
selectedPageView.getFirstVisibleCfi,
selectedPageView.getLastVisibleCfi

Fix ScrollView get first/last visible CFI by calculating the right visibleContentOffsets & frameDimensions