Skip to content

Commit

Permalink
> Fixed
Browse files Browse the repository at this point in the history
- Adjust height now tries 10 intervals of 300ms so that slow content has a change to adjust the
  height.
  • Loading branch information
Darío Javier Cravero committed Jul 29, 2015
1 parent f9a1ad2 commit 4f03d2c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 42 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
@@ -1,5 +1,10 @@
# Change log

## [0.4.25] - 2015-07-29
## Fixed
- Adjust height now tries 10 intervals of 300ms so that slow content has a change to adjust the
height.

## [0.4.24] - 2015-07-22
### Changed
- Prevent default behaviour for click on `a` tags with `data-ignore` on it.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@hmh/readium",
"version": "0.4.24",
"version": "0.4.25",
"description": "readium",
"main": "src/index.js",
"readme": "README.md",
Expand Down
44 changes: 3 additions & 41 deletions src/sdk/views/scroll-view.js
Expand Up @@ -39,6 +39,7 @@ var PageOpenRequest = require('../models/page-open-request')
var setStyles = require('../helpers/set-styles')
var ViewerSettings = require('../models/viewer-settings')


/**
* Renders content inside a scrollable view port
* @param options
Expand Down Expand Up @@ -326,6 +327,7 @@ function ScrollView(options, isContinuousScroll, reader) {
}

var tryAgainFunc = function(tryAgain) {
var _DEBUG = true;
if (_DEBUG && tryAgain !== MAX_ATTEMPTS) {
console.log("tryAgainFunc - " + tryAgain + ": " + href + " <" + initialContentHeight + " -- " + previousPolledContentHeight + ">");
}
Expand Down Expand Up @@ -371,49 +373,9 @@ function ScrollView(options, isContinuousScroll, reader) {
} else {
updatePageViewSize(pageView);
}

if (isIframeAlive(iframe)) {
var win = iframe.contentWindow;
var doc = iframe.contentDocument;

var docHeightAfter = parseInt(Math.round(parseFloat(win.getComputedStyle(doc.documentElement).height))); //body can be shorter!
var iframeHeightAfter = parseInt(Math.round(parseFloat(window.getComputedStyle(iframe).height)));

var newdiff = iframeHeightAfter - docHeightAfter;
if (Math.abs(newdiff) > 4) {
if (_DEBUG) {
console.error("## IFRAME HEIGHT ADJUST: " + href + " [" + newdiff + "]<" + initialContentHeight + " -- " + previousPolledContentHeight + ">");
console.log(msg);
}

tryAgainFunc(tryAgain);
return;
} else {
if (_DEBUG) {
console.log(">> IFRAME HEIGHT ADJUSTED OKAY: " + href + " [" + diff + "]<" + initialContentHeight + " -- " + previousPolledContentHeight + ">");
// console.log(msg);
}
}
} else {
if (_DEBUG) {
console.log("tryAgainFunc ! win && doc (iFrame disposed?)");
}

if (callback) callback(false);
return;
}
} else {
//if (_DEBUG)
// console.debug("IFRAME HEIGHT NO NEED ADJUST: " + href);
// console.log(msg);
}
} else {
if (_DEBUG) {
console.log("tryAgainFunc ! win && doc (iFrame disposed?)");
}

if (callback) callback(false);
return;
return tryAgainFunc(tryAgain);
}
} catch (ex) {
console.error(ex);
Expand Down

0 comments on commit 4f03d2c

Please sign in to comment.