zoomToPublicationViewportRect

abstract fun zoomToPublicationViewportRect(rect: Rect, unit: LengthUnit, options: TransformRectZoomOptions = TransformRectZoomOptions(), onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Applies a transform to the ReaderView that will scale and translate publication content so that the specified rectangle coordinates 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 ReaderViewTransformManagerOptions.maxScaleFactor.

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

Calls onSuccess when the new active transform has finished animating or if the transform change is not animated.

Calls onError if:

  • canTransform returns false.

  • the operation was aborted while animating.

  • The coordinates or scale contained invalid values.

Parameters

rect

The rect in the publication viewport defining the area to zoom to.

unit

The unit of the values in the rect.

options
  • Further configures the transform, including how it is animated.


abstract suspend fun zoomToPublicationViewportRect(rect: Rect, unit: LengthUnit, options: TransformRectZoomOptions = TransformRectZoomOptions()): ColibrioResult<Unit>

Applies a transform to the ReaderView that will scale and translate publication content so that the specified rectangle coordinates 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 ReaderViewTransformManagerOptions.maxScaleFactor.

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

Returns ColibrioResult.Success when the new active transform has finished animating or if the transform change is not animated.

Returns ColibrioResult.Error if:

  • canTransform returns false.

  • the operation was aborted while animating.

  • The coordinates or scale contained invalid values.

Parameters

rect

The rect in the publication viewport defining the area to zoom to.

unit

The unit of the values in the rect.

options
  • Further configures the transform, including how it is animated.