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

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/Geometry.js

Issue 1975723003: DevTools: fix janky transition in sensors panel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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: third_party/WebKit/Source/devtools/front_end/common/Geometry.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
index 4f51a59574eb9dd99ecc96100967259d8a417d48..eed79f946032bbb6ac6714f37e24566f26c994aa 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
@@ -200,6 +200,25 @@ WebInspector.Geometry.EulerAngles.fromRotationMatrix = function(rotationMatrix)
return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha), WebInspector.Geometry.radToDeg(beta), WebInspector.Geometry.radToDeg(gamma));
}
+WebInspector.Geometry.EulerAngles.prototype = {
+ /**
+ * @return {string}
+ */
+ toRotate3DString: function()
+ {
+ var gammaAxisY = Math.sin(WebInspector.Geometry.degToRad(this.beta));
+ var gammaAxisZ = Math.cos(WebInspector.Geometry.degToRad(this.beta));
+ var axis = {
+ alpha: [0, -1, 0],
+ beta: [1, 0, 0],
+ gamma: [0, gammaAxisY, gammaAxisZ]
+ };
+ return "rotate3d(" + axis.alpha.join(",") + "," + this.alpha + "deg) "
+ + "rotate3d(" + axis.beta.join(",") + "," + this.beta + "deg) "
+ + "rotate3d(" + axis.gamma.join(",") + "," + this.gamma + "deg)";
+ }
+}
+
/**
* @param {!WebInspector.Geometry.Vector} u
* @param {!WebInspector.Geometry.Vector} v
@@ -268,6 +287,15 @@ WebInspector.Geometry.calculateAngle = function(u, v)
}
/**
+ * @param {number} deg
+ * @return {number}
+ */
+WebInspector.Geometry.degToRad = function(deg)
lushnikov 2016/05/16 21:51:08 .toRadians = We avoid abbreviations as much as p
luoe 2016/05/16 22:15:56 Sounds good. I was trying to match the style of "
+{
+ return deg * Math.PI / 180;
+}
+
+/**
* @param {number} rad
* @return {number}
*/

Powered by Google App Engine
This is Rietveld 408576698