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

Unified Diff: Source/web/WebInputEventConversion.cpp

Issue 1192563002: Pass real tilt information to PointerEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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: 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)

Powered by Google App Engine
This is Rietveld 408576698