Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
This repository was archived by the owner on May 7, 2025. It is now read-only.

reflow intra spine item page load event triggered too early #57

Open
@RichardPat

Description

@RichardPat

In a reflow document, when attempting to animate the uiwebview during a page transition within the same spine item, I discovered that the page loaded event is sent before the uiwebview visually updates.

Whilst experimenting with animations using javascript, I found a solution that renders the offset change before sending the page load event by animating an opacity change in the document. I'm not certain why it works, or if it's uiwebview specific, but I'm posting it here for further evaluation in the hopes that maybe a cleaner solution can be found.

In reflowable_view.js :

function redraw() {
    var offsetVal =  -_paginationInfo.pageOffset + "px";

    _$epubHtml.css("opacity", "0.01");

    if (_htmlBodyIsVerticalWritingMode)
    {   
        _$epubHtml.animate({
                           top: offsetVal,
                           opacity: 1
                           }, 0, function() {
                           });
    }
    else
    {
        var ltr = _htmlBodyIsLTRDirection || _htmlBodyIsLTRWritingMode;
        _$epubHtml.animate({
                           left: ltr ? offsetVal : "",
                           right: !ltr ? offsetVal : "",
                           opacity: 1
                           }, 0, function() {
                           });
    }

    showBook(); // as it's no longer hidden by shifting the position
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions