Index: Source/web/WebInputEventConversion.cpp |
diff --git a/Source/web/WebInputEventConversion.cpp b/Source/web/WebInputEventConversion.cpp |
index 12c590fbeea5952009cf5561f3526a10bc06d488..6d4a7adab03f1b1af7911f7eb8ecdf4ba4b39109 100644 |
--- a/Source/web/WebInputEventConversion.cpp |
+++ b/Source/web/WebInputEventConversion.cpp |
@@ -429,6 +429,29 @@ PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo |
m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY)); |
m_rotationAngle = point.rotationAngle; |
m_force = point.force; |
+ // TODO(e_hakkinen): Leave only either tilt and tiltOrientation, tiltRad and |
+ // tiltOrientationRad or tiltX and tiltY. |
+ if (point.tilt) { |
mustaq
2015/06/17 19:43:28
Yes, representing the 3D tilt with two dedicated s
USE eero AT chromium.org
2015/06/18 11:34:08
Done.
|
+ float tiltOrientationRad = point.tiltOrientation * M_PI / 180.f; |
+ float tiltRad = point.tilt * M_PI / 180.f; |
+ float r = sin(tiltRad); |
+ float z = cos(tiltRad); |
+ m_tilt = FloatPoint( |
+ atan2(sin(tiltOrientationRad) * r, z) * 180.f / M_PI, |
+ atan2(-cos(tiltOrientationRad) * r, z) * 180.f / M_PI); |
+ } else { |
+ m_tilt = FloatPoint(0, 0); |
+ } |
+ if (point.tiltRad) { |
+ float r = sin(point.tiltRad); |
+ float z = cos(point.tiltRad); |
+ m_tilt = FloatPoint( |
+ atan2(sin(point.tiltOrientationRad) * r, z) * 180.f / M_PI, |
+ atan2(-cos(point.tiltOrientationRad) * r, z) * 180.f / M_PI); |
+ } else { |
+ m_tilt = FloatPoint(0, 0); |
+ } |
+ m_tilt = FloatPoint(point.tiltX, point.tiltY); |
} |
PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTouchEvent& event) |