Options
All
  • Public
  • Public/Protected
  • All
Menu

Used for programmatically managing transformations of the ReaderView, such as scaling and translating. Get an instance of this type by calling readerView.getTransformManager()

Hierarchy

  • IReaderViewTransformManager

Index

Methods

applyTransform

  • Applies the given transform on the ReaderView. Passing null will remove the ReaderView's active transform.

    throws

    This method throws an error if canTransform() returns false.

    Parameters

    Returns void

canTransform

  • canTransform(): boolean
  • Checks if it's possible to transform the ReaderView at this time.

    Returns boolean

getActiveTransform

  • Get the current active transform applied to the ReaderView.

    A value of null means there is no active transform on the ReaderView.

    Returns ITransformData

removeActiveTransform

  • Remove the ReaderView's current active transform.

    Returns a Promise that resolves when the active transform has been removed. It resolves immediately if the transform change is not animated.

    The returned Promise is rejected if:

    • canTransform() returns false.
    • the operation was aborted while animating.
    • The coordinates or scale contained invalid values.

    Parameters

    Returns Promise<void>

zoomToClientPosition

  • zoomToClientPosition(clientX: number, clientY: number, scale: number, animationOptions?: ITransformAnimationOptions): Promise<void>
  • Applies a transform to the ReaderView that will scale and translate publication content. The publication content at the X and Y coordinate in the application's viewport is centered in the ReaderView.

    Returns a Promise that resolves when the new active transform has finished animating. It resolves immediately if the transform change is not animated.

    The returned Promise is rejected if:

    • canTransform() returns false.
    • the operation was aborted while animating.
    • The coordinates or scale contained invalid values.

    Parameters

    • clientX: number

      The X coordinate in the application's viewport.

    • clientY: number

      The Y coordinate in the application's viewport.

    • scale: number

      The desired scale. Normal scale is 1 and bigger numbers means more zoomed in. Values lower than 1 will be capped to 1.

    • Optional animationOptions: ITransformAnimationOptions

      Specifies how the transform should be animated.

    Returns Promise<void>

zoomToClientRect

  • Applies a transform to the ReaderView that will scale and translate publication content so that the specified rectangle is centered in the ReaderView.

    The ReaderView will be scaled as much as possible while still ensuring that the rect is fully visible in the ReaderView. Note also that the ReaderView will never be scaled more than IReaderViewTransformManagerOptions.maxScaleFactor.

    You can also specify a maxScaleFactor and configure other parameters for this transform by passing an options object.

    Returns a Promise that resolves when the new active transform has finished animating. It resolves immediately if the transform change is not animated.

    The returned Promise is rejected if:

    • canTransform() returns false.
    • the operation was aborted while animating.
    • The coordinates or scale contained invalid values.

    Parameters

    • rect: DOMRect

      The client rect in application's viewport coordinate space defining the area to zoom to. be capped to 1.

    • Optional options: ITransformRectZoomOptions

      Further configures the transform, including how it is animated.

    Returns Promise<void>

zoomToEventPosition

  • Applies a transform to the ReaderView using a MouseEngineEvent or PointerEngineEvent. The transform will scale and translate publication content so that the specified position is centered in the ReaderView.

    This method has the same effect as zoomToClientPosition(event.clientX, event.clientY,...) with the difference that zoomToClientPosition returns a Promise for signaling success or failure.

    throws

    An EngineError if canTransform() returns false.

    deprecated

    Please use zoomToClientPosition(event.clientX, event.clientY, scale, ...) instead.

    Parameters

    • event: IMouseEngineEvent

      An IMouseEngineEvent or IPointerEngineEvent used for calculating the center point of the zoom.

    • scale: number

      The desired scale. Normal scale is 1 and bigger numbers means more zoomed in. Values lower than 1 will be capped to 1.

    • Optional animationOptions: ITransformAnimationOptions

      Specifies how the transform should be animated.

    Returns void

zoomToPublicationViewportPosition

  • Applies a transform to the ReaderView that will scale and translate publication content so that the specified position is centered in the ReaderView.

    This method uses the publication viewport as coordinate system, where (0, 0) is at the top-left of the left-most visible page.

    This method accepts relative coordinates in percentage where (0%, 0%) means top-left of the left-most visible page and (100%, 100%) means bottom-right of the right-most visible page.

    Returns a Promise that resolves when the new active transform has finished animating. The returned Promise is rejected if:

    • canTransform() returns false.
    • the operation was aborted while animating.
    • The coordinates or scale contained invalid values.

    Parameters

    • x: ILength

      The X coordinate in the publication viewport.

    • y: ILength

      The Y coordinate in the publication viewport.

    • scale: number

      The desired scale. Normal scale is 1 and bigger numbers means more zoomed in. Values lower than 1 will be capped to 1.

    • Optional animationOptions: ITransformAnimationOptions

      Specifies how the transform should be animated.

    Returns Promise<void>

zoomToPublicationViewportRect

  • Applies a transform to the ReaderView that will scale and translate publication content so that the specified rectangle is centered in the ReaderView.

    This method uses the publication viewport as coordinate system, where (0, 0) is at the top-left of the left-most visible page.

    This method accepts relative coordinates in percentage, when the unit is PERCENT, where (0%, 0%) means top-left of the left-most visible page and (100%, 100%) means bottom-right of the right-most visible page.

    The ReaderView will be scaled as much as possible while still ensuring that the rect is fully visible in the ReaderView. Note also that the ReaderView will never be scaled more than IReaderViewTransformManagerOptions.maxScaleFactor.

    You can also specify a maxScaleFactor and configure other parameters for this transform by passing an options object.

    Returns a Promise that resolves when the new active transform has finished animating. It resolves immediately if the transform change is not animated.

    The returned Promise is rejected if:

    • canTransform() returns false.
    • the operation was aborted while animating.
    • The coordinates or scale contained invalid values.

    Parameters

    • rect: DOMRect

      The client rect in publication's viewport coordinate space defining the area to zoom to.

    • unit: LengthUnit

      The unit of the values in the rect

    • Optional options: ITransformRectZoomOptions

      Further configures the transform, including how it is animated.

    Returns Promise<void>

Generated using TypeDoc