interface ZoomApi
An interface for zoom controls.
annotation class AbsolutePan
Annotation to indicate an AbsolutePan value. |
|
annotation class Alignment
Defines the available alignments |
|
annotation class RealZoom
Annotation to indicate a RealZoom value. |
|
annotation class ScaledPan
Annotation to indicate a ScaledPan value. |
|
annotation class Transformation
Defines the available transformation types |
|
annotation class Zoom
Annotation to indicate a zoom value. |
|
annotation class ZoomType
Defines the available zoom types |
abstract val pan: AbsolutePoint
The current pan as an AbsolutePoint. |
|
abstract val panX: Float
Returns the current horizontal pan value, in content absolute coordinates (that is, as if there was no zoom at all). |
|
abstract val panY: Float
Returns the current vertical pan value, in content absolute coordinates (that is, as if there was no zoom at all). |
|
abstract val realZoom: Float
Gets the current zoom value, including the base zoom that was eventually applied when initializing to respect the "center inside" policy. This will match the scaleX - scaleY values you get into the Matrix, and is the actual scale value of the content from its original size. |
|
abstract val scaledPan: ScaledPoint
The current pan as a ScaledPoint, that is, taking into account the current zoom. This basically returns the pan value multiplied by the current realZoom. |
|
abstract val scaledPanX: Float
Returns the current horizontal pan value, in content scaled coordinates (that is, including the current zoom). This is equivalent to panX multiplied by realZoom. |
|
abstract val scaledPanY: Float
Returns the current vertical pan value, in content scaled coordinates (that is, including the current zoom). This is equivalent to panY multiplied by realZoom. |
|
abstract val zoom: Float
Gets the current zoom value, which can be used as a reference when calling ZoomApi.zoomTo or ZoomApi.zoomBy. |
abstract fun cancelAnimations(): Boolean
Cancels all currently active animations triggered by either API calls with |
|
abstract fun moveTo(zoom: Float, x: Float, y: Float, animate: Boolean): Unit
A low level API that can animate both zoom and pan at the same time. Zoom might not be the actual matrix scale, see ZoomApi.zoom and ZoomApi.realZoom. The coordinates are referred to the content size so they do not depend on current zoom. |
|
abstract fun panBy(dx: Float, dy: Float, animate: Boolean): Unit
Pans the content by the given quantity in dx-dy values. These are referred to the content size so they do not depend on current zoom. |
|
abstract fun panTo(x: Float, y: Float, animate: Boolean): Unit
Pans the content until the top-left coordinates match the given x-y values. These are referred to the content size so they do not depend on current zoom. |
|
abstract fun realZoomTo(realZoom: Float, animate: Boolean): Unit
Animates the actual matrix zoom to the given value. |
|
abstract fun setAlignment(alignment: Int): Unit
Sets the content alignment. Can be any of the constants defined in com.otaliastudios.zoom.Alignment. The content will be aligned and forced to the specified side of the container. Defaults to ALIGNMENT_DEFAULT. |
|
abstract fun setAllowFlingInOverscroll(allow: Boolean): Unit
Controls whether fling events are allowed when the view is in an overscrolled state. |
|
abstract fun setAnimationDuration(duration: Long): Unit
Sets the duration of animations triggered by zoom and pan APIs. Defaults to ZoomEngine.DEFAULT_ANIMATION_DURATION. |
|
abstract fun setFlingEnabled(enabled: Boolean): Unit
Controls whether fling gesture is enabled or not. |
|
abstract fun setHorizontalPanEnabled(enabled: Boolean): Unit
Controls whether horizontal panning using gestures is enabled. |
|
abstract fun setMaxZoom(maxZoom: Float, type: Int): Unit
Which is the max zoom that should be allowed. If ZoomApi.setOverPinchable is set to true, this can be over-pinched for a brief time. |
|
abstract fun setMinZoom(minZoom: Float, type: Int): Unit
Which is the min zoom that should be allowed. If ZoomApi.setOverPinchable is set to true, this can be over-pinched for a brief time. |
|
abstract fun setOneFingerScrollEnabled(enabled: Boolean): Unit
Controls whether one finger scroll gesture is enabled or not. |
|
abstract fun setOverPinchable(overPinchable: Boolean): Unit
Controls whether the content should be overPinchable. If it is, pinch events can change the zoom outside the safe bounds, than return to safe values. |
|
abstract fun setOverScrollHorizontal(overScroll: Boolean): Unit
Controls whether the content should be over-scrollable horizontally. If it is, drag and fling horizontal events can scroll the content outside the safe area, then return to safe values. |
|
abstract fun setOverScrollVertical(overScroll: Boolean): Unit
Controls whether the content should be over-scrollable vertically. If it is, drag and fling vertical events can scroll the content outside the safe area, then return to safe values. |
|
abstract fun setScrollEnabled(enabled: Boolean): Unit
Controls whether scroll gesture is enabled or not. |
|
abstract fun setThreeFingersScrollEnabled(enabled: Boolean): Unit
Controls whether three fingers scroll gesture is enabled or not. |
|
open fun setTransformation(transformation: Int): Unit
Sets the base transformation to be applied to the content. See setTransformation. abstract fun setTransformation(transformation: Int, gravity: Int): Unit
Sets the base transformation to be applied to the content. Defaults to TRANSFORMATION_CENTER_INSIDE with android.view.Gravity.CENTER, which means that the content will be zoomed so that it fits completely inside the container. |
|
abstract fun setTwoFingersScrollEnabled(enabled: Boolean): Unit
Controls whether two fingers scroll gesture is enabled or not. |
|
abstract fun setVerticalPanEnabled(enabled: Boolean): Unit
Controls whether vertical panning using gestures is enabled. |
|
abstract fun setZoomEnabled(enabled: Boolean): Unit
Controls whether zoom using pinch gesture is enabled or not. |
|
abstract fun zoomBy(zoomFactor: Float, animate: Boolean): Unit
Applies the given factor to the current zoom. |
|
abstract fun zoomIn(): Unit
Applies a small, animated zoom-in. |
|
abstract fun zoomOut(): Unit
Applies a small, animated zoom-out. |
|
abstract fun zoomTo(zoom: Float, animate: Boolean): Unit
Zooms to the given scale. This might not be the actual matrix zoom, see ZoomApi.zoom and ZoomApi.realZoom. |
const val ALIGNMENT_DEFAULT: Int
The default value for setAlignment. |
|
const val MAX_ZOOM_DEFAULT: Float
The default setMaxZoom applied by the engine if none is specified. |
|
const val MAX_ZOOM_DEFAULT_TYPE: Int
The default setMaxZoom type applied by the engine if none is specified. |
|
const val MIN_ZOOM_DEFAULT: Float
The default setMinZoom applied by the engine if none is specified. |
|
const val MIN_ZOOM_DEFAULT_TYPE: Int
The default setMinZoom type applied by the engine if none is specified. |
|
const val TRANSFORMATION_CENTER_CROP: Int
Constant for ZoomApi.setTransformation. The content will be zoomed so that its smaller side fits exactly inside the container. The larger side will be partially cropped. |
|
const val TRANSFORMATION_CENTER_INSIDE: Int
Constant for ZoomApi.setTransformation. The content will be zoomed so that it fits completely inside the container. |
|
const val TRANSFORMATION_GRAVITY_AUTO: Int
Constant for ZoomApi.setTransformation gravity. This means that the gravity will be inferred from the alignment or fallback to a reasonable default. |
|
const val TRANSFORMATION_NONE: Int
Constant for ZoomApi.setTransformation. No transformation will be applied, which means that both ZoomApi.zoom and ZoomApi.realZoom will return the same value. |
|
const val TYPE_REAL_ZOOM: Int
Flag for zoom constraints and settings. With ZoomApi.TYPE_REAL_ZOOM the constraint is measured over the zoom in ZoomApi.realZoom, which is the actual scale you get in the matrix. |
|
const val TYPE_ZOOM: Int
Flag for zoom constraints and settings. With ZoomApi.TYPE_ZOOM the constraint is measured over the zoom in ZoomApi.zoom. This is not the actual matrix scale value. |
open class ZoomEngine : ZoomApi
A low level class that listens to touch events and posts zoom and pan updates. The most useful output is a Matrix that can be used to do pretty much everything, from canvas drawing to View hierarchies translations. |
|
open class ZoomImageView : ImageView, ZoomApi
Uses ZoomEngine to allow zooming and pan events to the inner drawable. |
|
open class ZoomLayout : FrameLayout, OnGlobalLayoutListener, ZoomApi
Uses ZoomEngine to allow zooming and pan events onto a view hierarchy. The hierarchy must be contained in a single view, added to this layout (like what you do with a ScrollView). |
|
open class ZoomSurfaceView : GLSurfaceView, ZoomApi, Renderer
Uses ZoomEngine to allow zooming and pan events onto a GL rendered surface. |