I want to determine whether the camera changed event was initiated from the user or not. (i have to make different actions based on that). So if the user pans a camera with the finger, i have to close sg, but if i moved the camera with the API, i do not.
Currently i cannot decide it was a user event or not, in my OnCameraChangeListener
, because the onCameraChange(CameraPosition var1)
method does not provide any kind of information about that.
I also tried to save the last marker position which i animated onto programmatically, and check that in the listener method:
map.setOnCameraChangeListener(new GoogelMap.onCameraChangeListener {
public void onCameraChange(CameraPosition position) {
if (!cameraPosition.target.equals(lastClickedMarker)) {
// this is a user event
}
}
I set the lastClickedMarker
with the OnMarkerClickListener
. I found out i cannot rely on this, because the cameraPosition
and lastClickedMarker
coordinates will always differ a little, even if really animate to that marker programmatically with animateCamera()
.
Is there any way to solve this?