Skip to content

Expose consistent page-turn metadata for native swipe pagination #133

Description

@atjackiejohns

Hi.

I’m using foliate-view in a web reader and ran into an issue distinguishing native mobile swipe page turns from other relocation events.

For button/programmatic navigation, I can call view.next() / view.prev(), so my app knows the intended direction, and Foliate relocates with reason: "page".

For native touch pagination, Foliate handles the gesture internally:

touchend -> snap(vx, vy) -> #scrollToPage(page, "snap")

The consumer then sees relocate events with reason: "snap" and sometimes follow-up reason: "anchor" events. From the public event data, it is hard to tell whether the snap represented:

  • a forward page turn
  • a backward page turn
  • settling back onto the same page
  • a non-reading/layout relocation

Would you consider exposing consistent page-turn metadata for native swipe pagination, either on the relocate.detail for reason: "snap" or as a separate event?

For example:

{
  reason: "snap",
  direction: "next" | "prev" | "none",
  fromPage,
  toPage,
  pages,
  index
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions