Skip to content

Settings

Alex Vasilkov edited this page Apr 4, 2017 · 5 revisions

You can get Settings with gestureView.getController().getSettings().

setMaxZoom(float maxZoom)

Max zoom level.
Default is 2f.

setDoubleTapZoom(float doubleTapZoom)

Double tap zoom level, should not be greater than max zoom level.
Default is -1f, means max zoom level will be used as double tap level.

setPanEnabled(boolean enabled)

Whether panning is enabled or not.
Default is true.

setZoomEnabled(boolean enabled)

Whether zooming is enabled or not.
Default is true.

setDoubleTapEnabled(boolean enabled)

Whether zooming by double tap is enabled or not.
Default is true.

setRotationEnabled(boolean enabled)

Whether rotation gesture is enabled or not.
Default is false.

setRestrictRotation(boolean restrict)

Whether image rotation should stick to 90 degrees intervals or can be free.
Only applied if isRestrictBounds() is true.
Default is false.

setOverscrollDistance(float distanceX, float distanceY)

Overscroll distance in pixels. User will be able to "over scroll" up to this distance. Cannot be < 0.
Default is to no overscroll (0f, 0f).

setOverzoomFactor(float factor)

Overzoom factor. User will be able to "over zoom" up to this factor. Cannot be < 1.
Default is 2f.

setFillViewport(boolean isFitViewport)

If set to true small image will be scaled to fit entire viewport (or entire movement area if it was set) even if this will require zoom level above max zoom level.
Default is false.

setFitMethod(Fit fitMethod)

Setting image fitting method within viewport area. Available values:

  • Fit.HORIZONTAL
    Fit image width inside viewport area
  • Fit.VERTICAL
    Fit image height inside viewport area
  • Fit.INSIDE
    Fit both image width and image height inside viewport area
  • Fit.OUTSIDE
    Fit image width or image height inside viewport area, so the entire viewport is filled up

Default is Fit.INSIDE.

setGravity(int gravity)

Image gravity inside viewport area. Available values are:

  • Gravity.CENTER
  • Gravity.CENTER_VERTICAL
  • Gravity.CENTER_HORIZONTAL
  • Gravity.TOP
  • Gravity.BOTTOM
  • Gravity.LEFT
  • Gravity.RIGHT
  • Gravity.START
  • Gravity.END
  • Any combinations of above

Default is Gravity.CENTER

disableGestures()

Disable all gestures.
Calls to this method are counted, so if you called it N times you should call enableGestures() N times to re-enable all gestures.
Useful when you need temporary disable touch gestures during animation or image loading.

enableGestures()

Re-enable all gestures disabled by disableGestures() method.

setMovementArea(int w, int h)

Movement area size.
Viewport area will be used instead if no movement area is specified.

setRestrictBounds(boolean isRestrictBounds)

Whether image transformations should be kept in bounds or not.
Can be set to false during animation to make it smoother, but you should ensure end state of animation is within bounds.
Default value is true.

setViewport(int w, int h)

Viewport size. Should only be used when implementing custom GestureView.

setImage(int w, int h)

Full image size. Should only be used when implementing custom GestureView.

Clone this wiki locally