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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js

Issue 1992383002: DevTools: add eslint as presubmit hook (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.SensorsView = function() 9 WebInspector.SensorsView = function()
10 { 10 {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 { 246 {
247 if (!deviceOrientation) 247 if (!deviceOrientation)
248 return; 248 return;
249 249
250 /** 250 /**
251 * @param {number} angle 251 * @param {number} angle
252 * @return {number} 252 * @return {number}
253 */ 253 */
254 function roundAngle(angle) 254 function roundAngle(angle)
255 { 255 {
256 return Math.round(angle*10000)/10000; 256 return Math.round(angle * 10000) / 10000;
257 } 257 }
258 258
259 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserInput) { 259 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserInput) {
260 this._alphaSetter(roundAngle(deviceOrientation.alpha)); 260 this._alphaSetter(roundAngle(deviceOrientation.alpha));
261 this._betaSetter(roundAngle(deviceOrientation.beta)); 261 this._betaSetter(roundAngle(deviceOrientation.beta));
262 this._gammaSetter(roundAngle(deviceOrientation.gamma)); 262 this._gammaSetter(roundAngle(deviceOrientation.gamma));
263 } 263 }
264 264
265 var animate = modificationSource !== WebInspector.SensorsView.DeviceOrie ntationModificationSource.UserDrag; 265 var animate = modificationSource !== WebInspector.SensorsView.DeviceOrie ntationModificationSource.UserDrag;
266 this._setBoxOrientation(deviceOrientation, animate); 266 this._setBoxOrientation(deviceOrientation, animate);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 _onBoxDrag: function(event) 334 _onBoxDrag: function(event)
335 { 335 {
336 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y); 336 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y);
337 if (!mouseMoveVector) 337 if (!mouseMoveVector)
338 return true; 338 return true;
339 339
340 event.consume(true); 340 event.consume(true);
341 var axis, angle; 341 var axis, angle;
342 if (event.shiftKey) { 342 if (event.shiftKey) {
343 axis = new WebInspector.Geometry.Vector(0, 0, -1); 343 axis = new WebInspector.Geometry.Vector(0, 0, -1);
344 angle = (this._mouseDownVector.x - mouseMoveVector.x)*WebInspector.S ensorsView.ShiftDragOrientationSpeed; 344 angle = (this._mouseDownVector.x - mouseMoveVector.x) * WebInspector .SensorsView.ShiftDragOrientationSpeed;
345 } else { 345 } else {
346 axis = WebInspector.Geometry.crossProduct(this._mouseDownVector, mou seMoveVector); 346 axis = WebInspector.Geometry.crossProduct(this._mouseDownVector, mou seMoveVector);
347 angle = WebInspector.Geometry.calculateAngle(this._mouseDownVector, mouseMoveVector); 347 angle = WebInspector.Geometry.calculateAngle(this._mouseDownVector, mouseMoveVector);
348 } 348 }
349 349
350 // The mouse movement vectors occur in the screen space, which is offset by 90 degrees from 350 // The mouse movement vectors occur in the screen space, which is offset by 90 degrees from
351 // the actual device orientation. 351 // the actual device orientation.
352 var currentMatrix = new WebKitCSSMatrix(); 352 var currentMatrix = new WebKitCSSMatrix();
353 currentMatrix = currentMatrix 353 currentMatrix = currentMatrix
354 .rotate(-90, 0, 0) 354 .rotate(-90, 0, 0)
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 * @return {boolean} 501 * @return {boolean}
502 */ 502 */
503 handleAction: function(context, actionId) 503 handleAction: function(context, actionId)
504 { 504 {
505 WebInspector.inspectorView.showViewInDrawer("sensors"); 505 WebInspector.inspectorView.showViewInDrawer("sensors");
506 return true; 506 return true;
507 } 507 }
508 } 508 }
509 509
510 WebInspector.SensorsView.ShiftDragOrientationSpeed = 16; 510 WebInspector.SensorsView.ShiftDragOrientationSpeed = 16;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698