Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip externalAgentSupport call when spineItem not available #409

Merged
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions js/views/reader_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ var ReaderView = function (options) {
_.defer(function () {
Globals.logEvent("PAGINATION_CHANGED", "EMIT", "reader_view.js");
self.emit(Globals.Events.PAGINATION_CHANGED, pageChangeData);

if (!pageChangeData.spineItem) return;
_.defer(function () {
Copy link
Member

Choose a reason for hiding this comment

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

pageChangeData.spineItem is also used in the Media Overlays player, via the line above (_mediaOverlayPlayer.onPageChanged(pageChangeData);). Thankfully, there are safeguards inside the MO code, so no crashes. Unfortunately, we use var spineItems = reader.getLoadedSpineItems(); to match pageChangeData.spineItem in multiple page spreads (fixed layout), so it would be nice if the spineItem property was set correctly in all view types (inc. reflow and scroll).

Copy link
Member

Choose a reason for hiding this comment

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

Note that I fixed the reflow view: 6d8beaa

_externalAgentSupport.updateContentDocument(pageChangeData.spineItem);
});
Expand Down