Bug 845747 - Add the pref "ui.scrolling.negate_wheel_scrollY" to mobile.js so that "scrollY" can be negated in JavaPanZoomController.java to allow a mouse scroll wheel to scroll the screen in the direction of choice depending on the true/false state of "mNegateWheelScrollY". r=kats

This commit is contained in:
Dennis 2013-08-27 21:01:40 -04:00
Родитель 1f9cf546ef
Коммит ce62d6288a
2 изменённых файлов: 23 добавлений и 8 удалений

Просмотреть файл

@ -655,6 +655,8 @@ pref("ui.scrolling.overscroll_snap_limit", -1);
pref("ui.scrolling.min_scrollable_distance", -1);
// The axis lock mode for panning behaviour - set between standard, free and sticky
pref("ui.scrolling.axis_lock_mode", "standard");
// Negate scrollY, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
pref("ui.scrolling.negate_wheel_scrollY", true);
// Enable accessibility mode if platform accessibility is enabled.

Просмотреть файл

@ -131,6 +131,8 @@ class JavaPanZoomController
private AxisLockMode mMode;
/* A medium-length tap/press is happening */
private boolean mMediumPress;
/* Used to change the scrollY direction */
private boolean mNegateWheelScrollY;
public JavaPanZoomController(PanZoomTarget target, View view, EventDispatcher eventDispatcher) {
mTarget = target;
@ -150,14 +152,23 @@ class JavaPanZoomController
mMode = AxisLockMode.STANDARD;
PrefsHelper.getPref("ui.scrolling.axis_lock_mode", new PrefsHelper.PrefHandlerBase() {
String[] prefs = { "ui.scrolling.axis_lock_mode", "ui.scrolling.negate_wheel_scrollY" };
mNegateWheelScrollY = false;
PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
@Override public void prefValue(String pref, String value) {
if (value.equals("standard")) {
mMode = AxisLockMode.STANDARD;
} else if (value.equals("free")) {
mMode = AxisLockMode.FREE;
} else {
mMode = AxisLockMode.STICKY;
if (pref.equals("ui.scrolling.axis_lock_mode")) {
if (value.equals("standard")) {
mMode = AxisLockMode.STANDARD;
} else if (value.equals("free")) {
mMode = AxisLockMode.FREE;
} else {
mMode = AxisLockMode.STICKY;
}
}
}
@Override public void prefValue(String pref, boolean value) {
if (pref.equals("ui.scrolling.negate_wheel_scrollY")) {
mNegateWheelScrollY = value;
}
}
@ -555,7 +566,9 @@ class JavaPanZoomController
if (mState == PanZoomState.NOTHING || mState == PanZoomState.FLING) {
float scrollX = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
float scrollY = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (mNegateWheelScrollY) {
scrollY *= -1.0;
}
scrollBy(scrollX * MAX_SCROLL, scrollY * MAX_SCROLL);
bounce();
return true;