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.

disableBounds()

Disable bounds restrictions. Calls to this method are counted, so if you called it N times you should call enableBounds() N times to re-enable bounds restrictions. Useful when you need to temporary disable bounds restrictions during animation.

enableBounds()

Re-enable bounds restrictions disabled by disableBounds() method.

setAnimationsDuration(long duration)

Animations durations.
Default value is 300L.

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.