Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Dispatch camera start callback only when actually moving #12172

Merged
merged 1 commit into from
Jun 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,25 +438,24 @@ public boolean onMoveBegin(MoveGestureDetector detector) {
}

transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

sendTelemetryEvent(Telemetry.PAN, detector.getFocalPoint());

notifyOnMoveBeginListeners(detector);

return true;
}

@Override
public boolean onMove(MoveGestureDetector detector, float distanceX, float distanceY) {
// dispatching start even once more if another detector ended, and this one didn't
cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE);
// first move event is often delivered with no displacement
if (distanceX != 0 || distanceY != 0) {
// dispatching camera start event only when the movement actually occurred
cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE);

// Scroll the map
transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/);
// Scroll the map
transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/);

notifyOnScrollListeners();
notifyOnMoveListeners(detector);
notifyOnScrollListeners();
notifyOnMoveListeners(detector);
}
return true;
}

Expand Down Expand Up @@ -485,7 +484,6 @@ public boolean onScaleBegin(StandardScaleGestureDetector detector) {
}

transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

quickZoom = detector.getPointersCount() == 1;
if (quickZoom) {
Expand Down Expand Up @@ -514,7 +512,7 @@ public boolean onScaleBegin(StandardScaleGestureDetector detector) {

@Override
public boolean onScale(StandardScaleGestureDetector detector) {
// dispatching start even once more if another detector ended, and this one didn't
// dispatching camera start event only when the movement actually occurred
cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE);

setScaleFocalPoint(detector);
Expand Down Expand Up @@ -615,7 +613,6 @@ public boolean onRotateBegin(RotateGestureDetector detector) {
}

transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

if (uiSettings.isIncreaseScaleThresholdWhenRotating()) {
// when rotation starts, interrupting scale and increasing the threshold
Expand All @@ -637,7 +634,7 @@ public boolean onRotateBegin(RotateGestureDetector detector) {
@Override
public boolean onRotate(RotateGestureDetector detector, float rotationDegreesSinceLast,
float rotationDegreesSinceFirst) {
// dispatching start even once more if another detector ended, and this one didn't
// dispatching camera start event only when the movement actually occurred
cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE);

setRotateFocalPoint(detector);
Expand Down Expand Up @@ -743,7 +740,6 @@ public boolean onShoveBegin(ShoveGestureDetector detector) {
}

transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);

sendTelemetryEvent(Telemetry.PITCH, detector.getFocalPoint());

Expand All @@ -757,7 +753,7 @@ public boolean onShoveBegin(ShoveGestureDetector detector) {

@Override
public boolean onShove(ShoveGestureDetector detector, float deltaPixelsSinceLast, float deltaPixelsSinceStart) {
// dispatching start even once more if another detector ended, and this one didn't
// dispatching camera start event only when the movement actually occurred
cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE);

// Get tilt value (scale and clamp)
Expand Down