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

Unified Diff: ui/events/blink/blink_event_util.cc

Issue 1187273004: Pass MotionEvent tilt angles to Blink on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
Index: ui/events/blink/blink_event_util.cc
diff --git a/ui/events/blink/blink_event_util.cc b/ui/events/blink/blink_event_util.cc
index b389600f23b33709d46b444a4dcb420368403f6b..d93f02ad17af36cf842157628fe409243ca06938 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -106,8 +106,6 @@ WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
if (event.GetToolType(pointer_index) == MotionEvent::TOOL_TYPE_STYLUS) {
mustaq 2015/06/17 20:01:27 We should convert MotionEvent orientation+tilt to
USE eero AT chromium.org 2015/06/18 11:34:07 Done.
// Orientation lies in [-180, 180] for a stylus. Normalise to [-90, 90).
// Allow a small bound tolerance to account for floating point conversion.
- // TODO(e_hakkinen): crbug.com/493728: Pass also unaltered orientation
- // to touch in order not to lose quadrant information.
DCHECK_GT(orientation_deg, -180.01f);
DCHECK_LT(orientation_deg, 180.01f);
if (orientation_deg >= 90.f)
@@ -137,6 +135,15 @@ WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
}
touch.force = event.GetPressure(pointer_index);
+ // TODO(e_hakkinen): Leave only either tilt and tiltOrientation, tiltRad and
+ // tiltOrientationRad or tiltX and tiltY.
+ touch.tilt = event.GetTilt(pointer_index) * 180.f / M_PI;
+ touch.tiltRad = event.GetTilt(pointer_index);
+ touch.tiltOrientation =
+ event.GetTiltOrientation(pointer_index) * 180.f / M_PI;
+ touch.tiltOrientationRad = event.GetTiltOrientation(pointer_index);
+ touch.tiltX = event.GetTiltX(pointer_index) * 180.f / M_PI;
+ touch.tiltY = event.GetTiltY(pointer_index) * 180.f / M_PI;
return touch;
}

Powered by Google App Engine
This is Rietveld 408576698