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

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

Issue 2860793003: Pass through tilt_x and tilt_y to blink (Closed)
Patch Set: Pass through tilt_x and tilt_y to blink Created 3 years, 7 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 7b3ee486d99c2ca2ac9c1dcbc73b9abfa6c64597..349e0ed4cce91d51e5ba3feb339dce3c9f85a8cd 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -145,8 +145,8 @@ WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
SetWebPointerPropertiesFromMotionEventData(
touch, event.GetPointerId(pointer_index),
event.GetPressure(pointer_index), event.GetOrientation(pointer_index),
- event.GetTilt(pointer_index), 0 /* no button changed */,
- event.GetToolType(pointer_index));
+ event.GetTiltX(pointer_index), event.GetTiltY(pointer_index),
+ 0 /* no button changed */, event.GetToolType(pointer_index));
touch.state = ToWebTouchPointState(event, pointer_index);
touch.position.x = event.GetX(pointer_index);
@@ -897,22 +897,18 @@ void SetWebPointerPropertiesFromMotionEventData(
int pointer_id,
float pressure,
float orientation_rad,
- float tilt_rad,
+ float tilt_x,
+ float tilt_y,
int android_buttons_changed,
int tool_type) {
-
webPointerProperties.id = pointer_id;
webPointerProperties.force = pressure;
if (tool_type == MotionEvent::TOOL_TYPE_STYLUS) {
// A stylus points to a direction specified by orientation and tilts to
// the opposite direction. Coordinate system is left-handed.
- float r = sin(tilt_rad);
- float z = cos(tilt_rad);
- webPointerProperties.tilt_x =
- lround(atan2(sin(-orientation_rad) * r, z) * 180.f / M_PI);
- webPointerProperties.tilt_y =
- lround(atan2(cos(-orientation_rad) * r, z) * 180.f / M_PI);
+ webPointerProperties.tilt_x = tilt_x;
+ webPointerProperties.tilt_y = tilt_y;
} else {
webPointerProperties.tilt_x = webPointerProperties.tilt_y = 0;
}

Powered by Google App Engine
This is Rietveld 408576698