Skip to content

Commit

Permalink
Fixing bug/osmdroid#1822 avoiding recreation of bug/osmdroid#1775.
Browse files Browse the repository at this point in the history
  • Loading branch information
frank committed Dec 21, 2022
1 parent 713f680 commit 7f83eb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Expand Up @@ -191,17 +191,14 @@ public boolean isTouched(final MotionEvent pMotionEvent) {
if (checkJustActivated()) {
return false;
}
boolean canExecute = mListener != null && pMotionEvent.getAction() == MotionEvent.ACTION_UP;
if (mDisplay.isTouched(pMotionEvent, true)) {
if (mZoomInEnabled && mListener != null) {
mListener.onZoom(true);
}
return true;
if ( canExecute && mZoomInEnabled ) mListener.onZoom(true);
return true;
}
if (mDisplay.isTouched(pMotionEvent, false)) {
if (mZoomOutEnabled && mListener != null) {
mListener.onZoom(false);
}
return true;
if ( canExecute && mZoomOutEnabled ) mListener.onZoom(false);
return true;
}
return false;
}
Expand All @@ -225,4 +222,4 @@ public boolean onLongPress(final MotionEvent pMotionEvent) {
public void draw(final Canvas pCanvas) {
mDisplay.draw(pCanvas, mAlpha01, mZoomInEnabled, mZoomOutEnabled);
}
}
}
Expand Up @@ -228,7 +228,8 @@ public boolean isTouchedRotated(final MotionEvent pMotionEvent, final boolean pI
* @since 6.1.3
*/
public boolean isTouched(final MotionEvent pMotionEvent, final boolean pInOrOut) {
if (pMotionEvent.getAction() == MotionEvent.ACTION_UP) {
int action = pMotionEvent.getAction();
if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP) {
return isTouched((int) pMotionEvent.getX(), (int) pMotionEvent.getY(), pInOrOut);
} else {
return false;
Expand Down

0 comments on commit 7f83eb4

Please sign in to comment.