public class GLMapGesturesDetector
extends java.lang.Object
implements android.view.View.OnTouchListener
| Constructor and Description |
|---|
GLMapGesturesDetector(GLMapView mapView)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
long |
getFlingSpeedGate()
Minimal speed to trigger fling event
Default implementation returns 400
|
long |
getFlingTimeGate()
If last move event was older that returned value no fling events will be triggered
Default implementation returns 100000000
|
long |
getLongPressDuration()
Time to trigger long press
Default implementation returns 1000000000
|
long |
getMaxTapsToDetect(int numberOfTouches)
Maximum taps to detect for given number of touches
Default implementation return 2 for 1 touch and 1 for others
|
long |
getMultiTapTimeGate()
Time between taps
Default implementation returns 250000000
|
int |
getNumberOfTouches()
Returns number of active touches
|
float |
getRotationGate()
Rotation starts when user rotates two fingers for more than returned value
Default implementation returns 10
|
float |
getTapDistanceGate()
Tap events disabled if movement of more then returned value is detected
Default implementation returns 10
|
float |
getTapZoomGate()
Tap events disabled if zoom of more than returned value is detected
Default implementation returns 1.01f
|
float |
getTouchX(int index)
Returns x coordinate of the touch
|
float |
getTouchY(int index)
Returns y coordinate of the touch
|
void |
onBegin()
Called when new touch started
Default implementation does noting
|
void |
onEnd()
Called when all touches ended
Default implementation rotate map to 0 if current angle is in range 340 ..
|
void |
onFling(float speedX,
float speedY)
Called when fling is detected
Default implementation starts deceleration animation
|
void |
onLongPress(int numberOfTouches,
float cx,
float cy)
Called when long press detected.
|
void |
onMove(float dx,
float dy)
Called when movement detected
Default implementation move map to new center without animation
|
void |
onRotate(float delta,
float cx,
float cy)
Called when rotation is detected
Default implementation rotate map with animation if delta is greater than rotation gate.
|
void |
onTap(int numberOfTouches,
int numberOfTaps,
float cx,
float cy)
Called when tap detected.
|
boolean |
onTouch(android.view.View v,
android.view.MotionEvent motionEvent) |
void |
onZoom(float k,
float cx,
float cy)
Called when zoom detected
|
void |
stopDetectingTouches()
Stop detecting touches util all current touches are up
|
public GLMapGesturesDetector(@NonNull
GLMapView mapView)
mapView - position, angle and zoom of this map will be modified by this detectorpublic void stopDetectingTouches()
public float getTouchX(int index)
index - index of touchpublic float getTouchY(int index)
index - index of touchpublic void onTap(int numberOfTouches,
int numberOfTaps,
float cx,
float cy)
numberOfTouches - number of touchesnumberOfTaps - number of tapscx - x coordinate of the touches centercy - y coordinate of the touches centerpublic void onLongPress(int numberOfTouches,
float cx,
float cy)
numberOfTouches - number of touchescx - x coordinate of the touches centercy - y coordinate of the touches centerpublic void onMove(float dx,
float dy)
dx - movement distance over x axis (px)dy - movement distance over y axis (px)public void onZoom(float k,
float cx,
float cy)
k - zoom coefficientcx - x coordinate of the touches centercy - y coordinate of the touches centerpublic void onFling(float speedX,
float speedY)
speedX - speed over x axis (px/s)speedY - speed over y axis (px/s)public void onRotate(float delta,
float cx,
float cy)
delta - angle delta (in degrees)cx - x coordinate of rotation center (in pixels)cy - y coordinate of rotation center (in pixels)public void onBegin()
public void onEnd()
public float getTapDistanceGate()
public float getTapZoomGate()
public float getRotationGate()
public long getFlingTimeGate()
public long getFlingSpeedGate()
public long getLongPressDuration()
public long getMultiTapTimeGate()
public long getMaxTapsToDetect(int numberOfTouches)
numberOfTouches - number of touchespublic int getNumberOfTouches()
public boolean onTouch(android.view.View v,
android.view.MotionEvent motionEvent)
onTouch in interface android.view.View.OnTouchListenerCopyright © 2018 GetYourMap. All Rights Reserved.