Skip to content

Commit

Permalink
fix #124 insensitive tap to drag on low dpi screens
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrupczak3 committed Apr 21, 2024
1 parent 6cd1733 commit b2cf282
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/com/openathena/MarkableImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.graphics.Paint;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
Expand Down Expand Up @@ -49,6 +50,10 @@ public MarkableImageView(Context context, AttributeSet attrs) {
}
parent = (AthenaActivity) context;

DisplayMetrics metrics = new DisplayMetrics();
float screen_pixel_density = getResources().getDisplayMetrics().density;
final float clickThreshold = 15f * screen_pixel_density;

scaleGestureDetector = new ScaleGestureDetector(context, new MyScaleGestureListener());
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
Expand All @@ -73,7 +78,6 @@ public boolean onDoubleTap(MotionEvent e) {
MarkableImageView yahweh = this; // reference to this MarkableImageView, for use in listener

this.setOnTouchListener(new View.OnTouchListener() {
private final float clickThreshold = 25f;
private float lastX, lastY;


Expand Down

0 comments on commit b2cf282

Please sign in to comment.