Class PanZoom
-
- All Implemented Interfaces:
-
android.view.View.OnTouchListener
public class PanZoom implements View.OnTouchListener
Enables basic pan/zoom touch behavior for an XYPlot. By default boundaries there are no boundaries imposed on scrolling and zooming. You can provide these boundaries on your XYPlot using getOuterLimits. TODO: zoom using dynamic center point TODO: stretch both mode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumPanZoom.Panpublic enumPanZoom.Zoompublic enumPanZoom.ZoomLimitLimits imposed on the zoom.
public classPanZoom.StateA snapshot of an XYPlot's domain and range boundaries, as captured by getState and restored by setState. Each boundary edge is stored independently; an edge whose mode is null is left untouched when the state is applied.
-
Field Summary
Fields Modifier and Type Field Description public PanZoom.Panpanpublic PanZoom.Zoomzoompublic PanZoom.ZoomLimitzoomLimitpublic booleanisEnabledpublic View.OnTouchListenerdelegate
-
Method Summary
Modifier and Type Method Description PanZoom.PangetPan()voidsetPan(@NonNull() PanZoom.Pan pan)PanZoom.ZoomgetZoom()voidsetZoom(@NonNull() PanZoom.Zoom zoom)PanZoom.ZoomLimitgetZoomLimit()voidsetZoomLimit(@NonNull() PanZoom.ZoomLimit zoomLimit)booleanisEnabled()voidsetEnabled(boolean enabled)View.OnTouchListenergetDelegate()voidsetDelegate(@Nullable() View.OnTouchListener delegate)Set a delegate to receive onTouch calls before this class does. PanZoom.StategetState()voidsetState(@NonNull() PanZoom.State state)Applies a previously captured state to the plot. static PanZoomattach(@NonNull() XYPlot plot)Convenience method for enabling pan/zoom behavior on an instance of XYPlot, using a default behavior of BOTH and SCALE. static PanZoomattach(@NonNull() XYPlot plot, @NonNull() PanZoom.Pan pan, @NonNull() PanZoom.Zoom zoom)Old method for enabling pan/zoom behavior on an instance of XYPlot, using the default behavior of OUTER. static PanZoomattach(@NonNull() XYPlot plot, @NonNull() PanZoom.Pan pan, @NonNull() PanZoom.Zoom zoom, @NonNull() PanZoom.ZoomLimit limit)New method for enabling pan/zoom behavior on an instance of XYPlot. booleanonTouch(View view, MotionEvent event)voidreset()-
-
Method Detail
-
getPan
@NonNull() PanZoom.Pan getPan()
-
setPan
void setPan(@NonNull() PanZoom.Pan pan)
-
getZoom
@NonNull() PanZoom.Zoom getZoom()
-
setZoom
void setZoom(@NonNull() PanZoom.Zoom zoom)
-
getZoomLimit
@NonNull() PanZoom.ZoomLimit getZoomLimit()
-
setZoomLimit
void setZoomLimit(@NonNull() PanZoom.ZoomLimit zoomLimit)
-
isEnabled
boolean isEnabled()
-
setEnabled
void setEnabled(boolean enabled)
-
getDelegate
@Nullable() View.OnTouchListener getDelegate()
-
setDelegate
void setDelegate(@Nullable() View.OnTouchListener delegate)
Set a delegate to receive onTouch calls before this class does. If the delegate wishes to consume the event, it should return true, otherwise it should return false. Returning false will not prevent future onTouch events from filtering through the delegate as it normally would when attaching directly to an instance of View.
-
getState
@NonNull() PanZoom.State getState()
- Returns:
A snapshot of the plot's current domain and range boundaries, reflecting any panning / zooming that has taken place. Suitable for persisting (eg. in an Activity's saved instance state) and later restoring via setState.
-
setState
void setState(@NonNull() PanZoom.State state)
Applies a previously captured state to the plot. Note that the plot is not redrawn.
-
attach
@NonNull() static PanZoom attach(@NonNull() XYPlot plot)
Convenience method for enabling pan/zoom behavior on an instance of XYPlot, using a default behavior of BOTH and SCALE. Use attach for finer grain control of this behavior.
-
attach
@NonNull() static PanZoom attach(@NonNull() XYPlot plot, @NonNull() PanZoom.Pan pan, @NonNull() PanZoom.Zoom zoom)
Old method for enabling pan/zoom behavior on an instance of XYPlot, using the default behavior of OUTER. Use attach for finer grain control of this behavior.
-
attach
@NonNull() static PanZoom attach(@NonNull() XYPlot plot, @NonNull() PanZoom.Pan pan, @NonNull() PanZoom.Zoom zoom, @NonNull() PanZoom.ZoomLimit limit)
New method for enabling pan/zoom behavior on an instance of XYPlot.
-
onTouch
boolean onTouch(View view, MotionEvent event)
-
reset
void reset()
-
-
-
-