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

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

Issue 1996013004: DevTools: better SensorsView orientation fix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 var alpha = Math.atan2(rotationMatrix.m12, rotationMatrix.m11); 199 var alpha = Math.atan2(rotationMatrix.m12, rotationMatrix.m11);
200 return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radiansTo Degrees(alpha), WebInspector.Geometry.radiansToDegrees(beta), WebInspector.Geome try.radiansToDegrees(gamma)); 200 return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radiansTo Degrees(alpha), WebInspector.Geometry.radiansToDegrees(beta), WebInspector.Geome try.radiansToDegrees(gamma));
201 } 201 }
202 202
203 WebInspector.Geometry.EulerAngles.prototype = { 203 WebInspector.Geometry.EulerAngles.prototype = {
204 /** 204 /**
205 * @return {string} 205 * @return {string}
206 */ 206 */
207 toRotate3DString: function() 207 toRotate3DString: function()
208 { 208 {
209 var gammaAxisY = Math.sin(WebInspector.Geometry.degreesToRadians(this.be ta)); 209 var gammaAxisY = -Math.sin(WebInspector.Geometry.degreesToRadians(this.b eta));
210 var gammaAxisZ = Math.cos(WebInspector.Geometry.degreesToRadians(this.be ta)); 210 var gammaAxisZ = Math.cos(WebInspector.Geometry.degreesToRadians(this.be ta));
211 var axis = { 211 var axis = {
212 alpha: [0, -1, 0], 212 alpha: [0, 1, 0],
213 beta: [1, 0, 0], 213 beta: [-1, 0, 0],
214 gamma: [0, gammaAxisY, gammaAxisZ] 214 gamma: [0, gammaAxisY, gammaAxisZ]
215 }; 215 };
216 return "rotate3d(" + axis.alpha.join(",") + "," + this.alpha + "deg) " 216 return "rotate3d(" + axis.alpha.join(",") + "," + this.alpha + "deg) "
217 + "rotate3d(" + axis.beta.join(",") + "," + this.beta + "deg) " 217 + "rotate3d(" + axis.beta.join(",") + "," + this.beta + "deg) "
218 + "rotate3d(" + axis.gamma.join(",") + "," + this.gamma + "deg)"; 218 + "rotate3d(" + axis.gamma.join(",") + "," + this.gamma + "deg)";
219 } 219 }
220 } 220 }
221 221
222 /** 222 /**
223 * @param {!WebInspector.Geometry.Vector} u 223 * @param {!WebInspector.Geometry.Vector} u
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 /** 521 /**
522 * @param {!Constraints|number} value 522 * @param {!Constraints|number} value
523 * @return {!Constraints} 523 * @return {!Constraints}
524 */ 524 */
525 Constraints.prototype.addHeight = function(value) 525 Constraints.prototype.addHeight = function(value)
526 { 526 {
527 if (typeof value === "number") 527 if (typeof value === "number")
528 return new Constraints(this.minimum.addHeight(value), this.preferred.add Height(value)); 528 return new Constraints(this.minimum.addHeight(value), this.preferred.add Height(value));
529 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred .addHeight(value.preferred)); 529 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred .addHeight(value.preferred));
530 } 530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698