Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PageFlip

Class representing a main PageFlip object

Hierarchy

Index

Constructors

constructor

  • new PageFlip(inBlock: HTMLElement, setting: Record<string, number | string | boolean>): PageFlip
  • Create a new PageFlip instance

    Parameters

    • inBlock: HTMLElement

      Root HTML Element

    • setting: Record<string, number | string | boolean>

      Configuration object

    Returns PageFlip

Methods

destroy

  • destroy(): void
  • Destructor. Remove a root HTML element and all event handlers

    Returns void

flip

  • Turn to the specified page number (with animation)

    Parameters

    • page: number

      New page number

    • Default value corner: FlipCorner = FlipCorner.TOP

      Active page corner when turning

    Returns void

flipNext

  • Turn to the next page (with animation)

    Parameters

    • Default value corner: FlipCorner = FlipCorner.TOP

      Active page corner when turning

    Returns void

flipPrev

  • Turn to the prev page (with animation)

    Parameters

    • Default value corner: FlipCorner = FlipCorner.TOP

      Active page corner when turning

    Returns void

getBoundsRect

getCurrentPageIndex

  • getCurrentPageIndex(): number
  • Get the index of the current page in the page list (starts at 0)

    Returns number

getFlipController

  • getFlipController(): Flip

getOrientation

getPage

  • getPage(pageIndex: number): Page
  • Get page from collection by number

    Parameters

    • pageIndex: number

    Returns Page

getPageCollection

getPageCount

  • getPageCount(): number
  • Get the total number of pages in a book

    Returns number

getRender

getSettings

getState

getUI

  • getUI(): UI

loadFromHTML

  • loadFromHTML(items: NodeListOf<HTMLElement> | HTMLElement[]): void
  • Load pages from HTML elements on the HTML mode

    Parameters

    • items: NodeListOf<HTMLElement> | HTMLElement[]

      List of pages as HTML Element

    Returns void

loadFromImages

  • loadFromImages(imagesHref: string[]): void
  • Load pages from images on the Canvas mode

    Parameters

    • imagesHref: string[]

      List of paths to images

    Returns void

off

  • off(event: string): void

on

startUserTouch

  • startUserTouch(pos: Point): void
  • Start page turning. Called when a user clicks or touches

    Parameters

    • pos: Point

      Touch position in coordinates relative to the book

    Returns void

turnToNextPage

  • turnToNextPage(): void
  • Turn to the next page (without animation)

    Returns void

turnToPage

  • turnToPage(page: number): void
  • Turn to the specified page number (without animation)

    Parameters

    • page: number

      New page number

    Returns void

turnToPrevPage

  • turnToPrevPage(): void
  • Turn to the previous page (without animation)

    Returns void

update

  • update(): void
  • Update the render area. Re-show current page.

    Returns void

updateFromHtml

  • updateFromHtml(items: NodeListOf<HTMLElement> | HTMLElement[]): void
  • Update current pages from HTML

    Parameters

    • items: NodeListOf<HTMLElement> | HTMLElement[]

      List of pages as HTML Element

    Returns void

updateFromImages

  • updateFromImages(imagesHref: string[]): void
  • Update current pages from images

    Parameters

    • imagesHref: string[]

      List of paths to images

    Returns void

updateOrientation

  • Call a page orientation change event trigger. Update UI and rendering area

    Parameters

    • newOrientation: Orientation

      New page orientation (portrait, landscape)

    Returns void

updatePageIndex

  • updatePageIndex(newPage: number): void
  • Call a page number change event trigger

    Parameters

    • newPage: number

      New page Number

    Returns void

updateState

userMove

  • userMove(pos: Point, isTouch: boolean): void
  • Called when a finger / mouse moves

    Parameters

    • pos: Point

      Touch position in coordinates relative to the book

    • isTouch: boolean

      True if there was a touch event, not a mouse click

    Returns void

userStop

  • userStop(pos: Point, isSwipe?: boolean): void
  • Сalled when the user has stopped touching

    Parameters

    • pos: Point

      Touch end position in coordinates relative to the book

    • Default value isSwipe: boolean = false

      true if there was a mobile swipe event

    Returns void

Generated using TypeDoc