Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Interface IReaderViewTransformManager

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

    interface IReaderViewTransformManager {
        applyTransform(
            transform: ITransformData,
            animationOptions?: ITransformAnimationOptions,
        ): void;
        canTransform(): boolean;
        getActiveTransform(): ITransformData;
        removeActiveTransform(
            animationOptions?: ITransformAnimationOptions,
        ): Promise<void>;
        zoomToClientPosition(
            clientX: number,
            clientY: number,
            scale: number,
            animationOptions?: ITransformAnimationOptions,
        ): Promise<void>;
        zoomToClientRect(
            rect: DOMRect,
            options?: ITransformRectZoomOptions,
        ): Promise<void>;
        zoomToPublicationViewportPosition(
            x: ILength,
            y: ILength,
            scale: number,
            animationOptions?: ITransformAnimationOptions,
        ): Promise<void>;
        zoomToPublicationViewportRect(
            rect: DOMRect,
            unit: LengthUnit,
            options?: ITransformRectZoomOptions,
        ): Promise<void>;
    }

    Methods

    • Checks if it's possible to transform the ReaderView at this time.

      Returns boolean

    • Get the current active transform applied to the ReaderView.

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

      Returns ITransformData

    • 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>

    • 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.

      • OptionalanimationOptions: ITransformAnimationOptions

        Specifies how the transform should be animated.

      Returns Promise<void>

    • 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.

      • Optionaloptions: ITransformRectZoomOptions

        Further configures the transform, including how it is animated.

      Returns Promise<void>

    • 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.

      • OptionalanimationOptions: ITransformAnimationOptions

        Specifies how the transform should be animated.

      Returns Promise<void>

    • 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

      • Optionaloptions: ITransformRectZoomOptions

        Further configures the transform, including how it is animated.

      Returns Promise<void>