Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java

Issue 1778063002: Eliminate pinch drift by removing touch radius from span calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shrink minimum scale span. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/android/java/res/values/dimens.xml ('k') | ui/events/gesture_detection/gesture_configuration.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java
diff --git a/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java b/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java
index 463ca9f678b8f91b1b474fefb0ac28a5635108e3..d728bdbd9b6f7478f1cd2720488a66d34137ca18 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java
@@ -25,8 +25,7 @@ public class ViewConfigurationHelper {
// Fallback constants when resource lookup fails, see
// ui/android/java/res/values/dimens.xml.
- private static final float MIN_SCALING_SPAN_MM = 27.0f;
- private static final float MIN_SCALING_TOUCH_MAJOR_DIP = 48.0f;
+ private static final float MIN_SCALING_SPAN_MM = 12.0f;
private final Context mAppContext;
private ViewConfiguration mViewConfiguration;
@@ -65,7 +64,7 @@ public class ViewConfigurationHelper {
mDensity = mAppContext.getResources().getDisplayMetrics().density;
assert mDensity > 0;
nativeUpdateSharedViewConfiguration(getMaximumFlingVelocity(), getMinimumFlingVelocity(),
- getTouchSlop(), getDoubleTapSlop(), getMinScalingSpan(), getMinScalingTouchMajor());
+ getTouchSlop(), getDoubleTapSlop(), getMinScalingSpan());
}
@CalledByNative
@@ -113,16 +112,12 @@ public class ViewConfigurationHelper {
return toDips(getScaledMinScalingSpan());
}
- @CalledByNative
- private float getMinScalingTouchMajor() {
- return toDips(getScaledMinScalingTouchMajor());
- }
-
private int getScaledMinScalingSpan() {
final Resources res = mAppContext.getResources();
- int id = res.getIdentifier("config_minScalingSpan", "dimen", "android");
- // Fall back to a sensible default if the internal identifier does not exist.
- if (id == 0) id = R.dimen.config_min_scaling_span;
+ // The correct minimum scaling span depends on how we recognize scale
+ // gestures. Since we've deviated from Android, don't use the Android
+ // system value here.
+ int id = R.dimen.config_min_scaling_span;
try {
return res.getDimensionPixelSize(id);
} catch (Resources.NotFoundException e) {
@@ -132,20 +127,6 @@ public class ViewConfigurationHelper {
}
}
- private int getScaledMinScalingTouchMajor() {
- final Resources res = mAppContext.getResources();
- int id = res.getIdentifier("config_minScalingTouchMajor", "dimen", "android");
- // Fall back to a sensible default if the internal identifier does not exist.
- if (id == 0) id = R.dimen.config_min_scaling_touch_major;
- try {
- return res.getDimensionPixelSize(id);
- } catch (Resources.NotFoundException e) {
- assert false : "MinScalingTouchMajor resource lookup failed.";
- return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
- MIN_SCALING_TOUCH_MAJOR_DIP, res.getDisplayMetrics());
- }
- }
-
/**
* @return the unscaled pixel quantity in DIPs.
*/
@@ -161,6 +142,5 @@ public class ViewConfigurationHelper {
}
private native void nativeUpdateSharedViewConfiguration(float maximumFlingVelocity,
- float minimumFlingVelocity, float touchSlop, float doubleTapSlop, float minScalingSpan,
- float minScalingTouchMajor);
+ float minimumFlingVelocity, float touchSlop, float doubleTapSlop, float minScalingSpan);
}
« no previous file with comments | « ui/android/java/res/values/dimens.xml ('k') | ui/events/gesture_detection/gesture_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698