Options
All
  • Public
  • Public/Protected
  • All
Menu

Used internally by the framework.

Used to render IRenderableDocumentPage(s) to the DOM (i.e. A Content Document or a Content Document fragment processed for rendering to the DOM).

Consumers should NOT interact with any IRendererRuntime method directly. Instead, use the ReaderView instance to handle navigations and query state.

IRenderableDocumentPageStream

When created, the RendererRuntime receives an IRendererContext object. The IRendererContext provides a linear traversable stream of IRenderableDocumentPage objects which should be rendered.

The RendererRuntime MUST call the methods in the passed RendererContext at the appropriate times to report its state, see RendererContext for more information.

Navigation

A call to navigateTo(), navigateToStart() will cause the RendererRuntime to perform the corresponding RendererNavigationAction (if the action is possible).

A RendererRuntime may deny a RendererNavigationAction if it cannot be performed at the time. For example, a RendererRuntime may not be able to perform navigate(RendererNavigationAction.NEXT) if in the middle of a goTo(), or if at the last page.

A RendererRuntime may cancel any ongoing RendererNavigationAction if another RendererNavigationAction is performed before the first one completes. For example, while performing RendererNavigationAction.NEXT, the user taps a TOC link which performs a goTo() action. The ongoing navigation RendererNavigationAction.NEXT is canceled and the RendererRuntime should instead perform the goTo() action.

Hierarchy

  • IRendererRuntime

Index

Methods

applyTransform

  • Applies the given transform to the RendererRuntime element.

    Parameters

    Returns void

getDisplayRect

  • getDisplayRect(): DOMRect
  • Get the rectangle used by this RendererRuntime to display publication content relative to the runtime container element. The rect should be defined in owner document coordinate system, i.e. without any transforms applied.

    Returns DOMRect

getPageContainerDimensions

  • getPageContainerDimensions(isCenterSpread: boolean): IDimensions
  • Get the dimensions for a page container element

    Note that if centerSpread is truthy, the renderer is allowed to express a wider dimension than a single page. It should however use the same height as when isCenterSpread is false.

    Parameters

    • isCenterSpread: boolean

      Set to true to get the dimensions of a center spread

    Returns IDimensions

    The page container dimensions.

getRenderablePageByElement

  • Get the renderable page instance associated with the given element if any.

    Parameters

    • element: Element

    Returns IRenderableDocumentPage

getRendererElement

  • getRendererElement(): HTMLElement
  • Get the root element for the renderer.

    Returns HTMLElement

getSwipeNavigationAxis

  • getSwipeNavigationAxis(): Axis
  • Get the axis on which the user needs to swipe to navigate to the previous or next page. Return null if swipe navigation is not supported.

    Returns Axis

handlePointerEngineEvent

  • Receives IPointerEngineEvent objects, while the user is performing a gesture that could result in a navigation. This allows the renderer to give immediate feedback to the user by "animating" the navigation gesture. This typically includes the event types "pointerdown", "pointermove", "pointerup" and "pointercancel"

    deprecated

    Parameters

    • event: IPointerEngineEvent

      The related IPointerEngineEvent

    • totalMoveX: number

      The total number of css pixels moved along the x-axis

    • totalMoveY: number

      The total number of css pixels moved along the y-axis

    Returns NEXT_CONTENT_RANGE | PREVIOUS_CONTENT_RANGE | NEXT_RENDERABLE_PAGE | PREVIOUS_RENDERABLE_PAGE | CURRENT

    A desired RendererNavigationAction or null if no action is to be taken.

isNativePanXAllowed

  • isNativePanXAllowed(): boolean
  • If the page content is allowed to use native pan/scroll along the x-axis

    Returns boolean

isNativePanYAllowed

  • isNativePanYAllowed(): boolean
  • If the page content is allowed to use native pan/scroll along the y-axis

    Returns boolean

navigate

  • Performs the specified navigation action.

    Returns a Promise that is resolved when the action has been processed and animated to completion. Rejected if the canPerformNavigation() returned false for the action. Rejected if the navigation is canceled because another action was performed before the navigation completed.

    Parameters

    • action: NEXT_CONTENT_RANGE | PREVIOUS_CONTENT_RANGE | NEXT_RENDERABLE_PAGE | PREVIOUS_RENDERABLE_PAGE | CURRENT

      One of the navigation actions NEXT_CONTENT_RANGE, PREVIOUS_CONTENT_RANGE, NEXT_RENDERABLE_PAGE, PREVIOUS_RENDERABLE_PAGE or CURRENT

    • contentRangeChangeCallbacks: IReaderViewContentRangeChangeCallbacks

      The renderer is responsible for setting the previous/visible/next ranges on the contentRangeChangeCallbacks once they have been calculated.

    • Optional intendedContentLocation: IContentLocation

      Used by scroll renderers for minimizing scroll. When attempting to synchronize with a SyncMediaPlayer, it describes the location that most closely matches the SyncMediaPosition. When performing next()/previous(), it describes last reported next/previous content range start position.

    • Optional syncMediaSegmentRange: IContentLocation

      Used by scroll renderers for minimizing scroll when attempting to synchronize with a SyncMediaPlayer. It describes the full range of the active segment and should be scrolled into view (but always keeping the intendedContentLocation in view). Only set when navigating due to an SyncMediaPlayer.attemptReaderViewSynchronization()

    Returns Promise<void>

navigateTo

  • Navigates to the given ContentLocation within the renderable page stream.

    MUST Reject if the RendererRuntime is destroyed.

    Any ongoing navigations started with wither navigate(), navigateTo() or navigateToStart() MUST be rejected with an ABORTED error when this method is called.

    Returns a Promise that is resolved when the GOTO action has been performed and pending animations have completed successfully. Rejected if the canPerformNavigation() returned false for the action. Rejected if the navigation is canceled because another action was performed before the animation completed. Rejected if "contentLocation" is invalid.

    Parameters

    Returns Promise<void>

Optional onContentHeightChanged

  • onContentHeightChanged(): void
  • Only used by scrolling renderers. Triggered when a document's height has changed (could be due to the initial render or scripts inside the document). Will only be triggered when rendering scripted documents.

    Returns void

Generated using TypeDoc