zoomToClientPosition

abstract fun zoomToClientPosition(clientX: Double, clientY: Double, scale: Double, animationOptions: TransformAnimationOptions? = TransformAnimationOptions(), onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Applies a transform to the ReaderView that will scale and translate publication content. The publication content at the X and Y coordinate in the ReaderView is centered in the ReaderView.

Note that the (x, y) coordinate refers to the WebView's internal client viewport in CSS pixels. You can receive coordinates in that coordinate system by listening on the various pointer events using ReaderView.addOnMouseEventListener or ReaderView.addOnPointerEventListener. The event object passed to those listeners contains the clientX and clientY properties which can be used with this method.

onSuccess is called when the new active transform has finished animating. onSuccess is called immediately if the transform change is not animated.

onError is called if:

  • canTransform is false.

  • the operation was aborted while animating.

  • The coordinates or scale contained invalid values.

Parameters

clientX

The X coordinate in the ReaderView.

clientY

The Y coordinate in the ReaderView.

scale

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

animationOptions

Specifies how the transform should be animated.


abstract suspend fun zoomToClientPosition(clientX: Double, clientY: Double, scale: Double, animationOptions: TransformAnimationOptions? = TransformAnimationOptions()): ColibrioResult<Unit>

Applies a transform to the ReaderView that will scale and translate publication content. The publication content at the X and Y coordinate in the ReaderView is centered in the ReaderView.

Note that the (x, y) coordinate refers to the WebView's internal client viewport in CSS pixels. You can receive coordinates in that coordinate system by listening on the various pointer events using ReaderView.addOnMouseEventListener or ReaderView.addOnPointerEventListener. The event object passed to those listeners contains the clientX and clientY properties which can be used with this method.

Returns success result when the new active transform has finished animating. Returns immediately if the transform change is not animated.

Returns error result if:

  • canTransform is false.

  • the operation was aborted while animating.

  • The coordinates or scale contained invalid values.

Parameters

clientX

The X coordinate in the ReaderView.

clientY

The Y coordinate in the ReaderView.

scale

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

animationOptions

Specifies how the transform should be animated.