Package it.tidalwave.image.render
Class MouseClickZoomingController
- java.lang.Object
-
- it.tidalwave.image.render.MouseClickZoomingController
-
public class MouseClickZoomingController extends java.lang.Object
This class activates zoom-by-click, that is the capability of zooming in and out on the image by clicking with the mouse over it. The click toggles the zoom between the 1:1 and the 'fit to view' values. The actual zooming behaviour is delegated to aScaleController
, which allows to plug different implementations (e.g. animations).- Author:
- Fabrizio Giudici
-
-
Constructor Summary
Constructors Constructor Description MouseClickZoomingController(ScaleController scaleController)
Creates a new instance of this class, attached to aScaleController
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getClickCountToZoom()
Returns the number of clicks requested to trigger the zooming.double
getFactor()
boolean
isEnabled()
Returns true if the controller is enabled.void
setClickCountToZoom(int clickCountToZoom)
Sets the number of clicks requested to trigger the zooming.void
setEnabled(boolean enabled)
Enables or disables this controller.void
setFactor(double factor)
-
-
-
Constructor Detail
-
MouseClickZoomingController
public MouseClickZoomingController(ScaleController scaleController)
Creates a new instance of this class, attached to aScaleController
. This controller must be activated withsetEnabled(true)
in order to be used.- Parameters:
scaleController
- the scale controller
-
-
Method Detail
-
setClickCountToZoom
public void setClickCountToZoom(int clickCountToZoom)
Sets the number of clicks requested to trigger the zooming.- Parameters:
clickCountToZoom
- the number of clicks
-
getClickCountToZoom
public int getClickCountToZoom()
Returns the number of clicks requested to trigger the zooming.
-
setEnabled
public void setEnabled(boolean enabled)
Enables or disables this controller. As this class attaches some listeners to the image renderer component, it's advisable to disable it when it's not needed, in order to facilitate garbage collection.- Parameters:
enabled
- true if must be enabled, false otherwise
-
isEnabled
public boolean isEnabled()
Returns true if the controller is enabled.- Returns:
- true if enabled
-
setFactor
public void setFactor(double factor)
-
getFactor
public double getFactor()
-
-