docs
This commit is contained in:
parent
f48144791b
commit
3c46fb15cf
@ -129,7 +129,7 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!mDown) {
|
if (!mDown) {
|
||||||
// no down event received
|
/* no down event received */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
float vx = mTracker.getVelocityX();
|
float vx = mTracker.getVelocityX();
|
||||||
float vy = mTracker.getVelocityY();
|
float vy = mTracker.getVelocityY();
|
||||||
|
|
||||||
// reduce velocity for short moves
|
/* reduce velocity for short moves */
|
||||||
float tx = e.getTime() - mStartMove;
|
float tx = e.getTime() - mStartMove;
|
||||||
if (tx < FLING_THREHSHOLD) {
|
if (tx < FLING_THREHSHOLD) {
|
||||||
vx *= tx / FLING_THREHSHOLD;
|
vx *= tx / FLING_THREHSHOLD;
|
||||||
@ -190,7 +190,7 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
mPrevX1 = x1;
|
mPrevX1 = x1;
|
||||||
mPrevY1 = y1;
|
mPrevY1 = y1;
|
||||||
|
|
||||||
// double-tap + hold
|
/* double-tap + hold */
|
||||||
if (mDoubleTap) {
|
if (mDoubleTap) {
|
||||||
|
|
||||||
mViewport.scaleMap(1 - my / (height / 8), 0, 0);
|
mViewport.scaleMap(1 - my / (height / 8), 0, 0);
|
||||||
@ -243,7 +243,7 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
tiltBy = my / 5;
|
tiltBy = my / 5;
|
||||||
} else if (Math.abs(my) > (CanvasAdapter.dpi /
|
} else if (Math.abs(my) > (CanvasAdapter.dpi /
|
||||||
MIN_SLOP * PINCH_TILT_THRESHOLD)) {
|
MIN_SLOP * PINCH_TILT_THRESHOLD)) {
|
||||||
// enter exclusive tilt mode
|
/* enter exclusive tilt mode */
|
||||||
mCanScale = false;
|
mCanScale = false;
|
||||||
mCanRotate = false;
|
mCanRotate = false;
|
||||||
mDoTilt = true;
|
mDoTilt = true;
|
||||||
@ -270,26 +270,25 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
} else {
|
} else {
|
||||||
r = Math.abs(r);
|
r = Math.abs(r);
|
||||||
if (r > PINCH_ROTATE_THRESHOLD) {
|
if (r > PINCH_ROTATE_THRESHOLD) {
|
||||||
// start rotate, disable tilt
|
/* start rotate, disable tilt */
|
||||||
mDoRotate = true;
|
mDoRotate = true;
|
||||||
mCanTilt = false;
|
mCanTilt = false;
|
||||||
|
|
||||||
mAngle = rad;
|
mAngle = rad;
|
||||||
} else if (!mDoScale) {
|
} else if (!mDoScale) {
|
||||||
// reduce pince trigger by the amount of
|
/* reduce pinch trigger by the amount of rotation */
|
||||||
// rotation
|
|
||||||
deltaPinch *= 1 - (r / PINCH_ROTATE_THRESHOLD);
|
deltaPinch *= 1 - (r / PINCH_ROTATE_THRESHOLD);
|
||||||
} else {
|
} else {
|
||||||
mPrevPinchWidth = pinchWidth;
|
mPrevPinchWidth = pinchWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mDoScale && mEnableRotate) {
|
} else if (mDoScale && mEnableRotate) {
|
||||||
// reenable rotation when higher threshold is reached
|
/* reenable rotation when higher threshold is reached */
|
||||||
double rad = Math.atan2(dy, dx);
|
double rad = Math.atan2(dy, dx);
|
||||||
double r = rad - mAngle;
|
double r = rad - mAngle;
|
||||||
|
|
||||||
if (r > PINCH_ROTATE_THRESHOLD2) {
|
if (r > PINCH_ROTATE_THRESHOLD2) {
|
||||||
// start rotate again
|
/* start rotate again */
|
||||||
mDoRotate = true;
|
mDoRotate = true;
|
||||||
mCanRotate = true;
|
mCanRotate = true;
|
||||||
mAngle = rad;
|
mAngle = rad;
|
||||||
@ -297,8 +296,9 @@ public class MapEventLayer extends Layer implements Map.InputListener, GestureLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCanScale || mDoRotate) {
|
if (mCanScale || mDoRotate) {
|
||||||
|
|
||||||
if (!(mDoScale || mDoRotate)) {
|
if (!(mDoScale || mDoRotate)) {
|
||||||
// enter exclusice scale mode
|
/* enter exclusice scale mode */
|
||||||
if (Math.abs(deltaPinch) > (CanvasAdapter.dpi
|
if (Math.abs(deltaPinch) > (CanvasAdapter.dpi
|
||||||
/ MIN_SLOP * PINCH_ZOOM_THRESHOLD)) {
|
/ MIN_SLOP * PINCH_ZOOM_THRESHOLD)) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user