| OLD | NEW |
| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Emulation.SensorsView = class extends UI.VBox { | 7 Emulation.SensorsView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(true); | 9 super(true); |
| 10 this.registerRequiredCSS('emulation/sensors.css'); | 10 this.registerRequiredCSS('emulation/sensors.css'); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // Validated input fieldset. | 71 // Validated input fieldset. |
| 72 this._fieldsetElement = fields.createChild('fieldset'); | 72 this._fieldsetElement = fields.createChild('fieldset'); |
| 73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled; | 73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled; |
| 74 this._fieldsetElement.id = 'geolocation-override-section'; | 74 this._fieldsetElement.id = 'geolocation-override-section'; |
| 75 | 75 |
| 76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group'
); | 76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group'
); |
| 77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group
'); | 77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group
'); |
| 78 | 78 |
| 79 this._latitudeInput = latitudeGroup.createChild('input'); | 79 this._latitudeInput = latitudeGroup.createChild('input'); |
| 80 this._latitudeInput.setAttribute('step', 'any'); |
| 80 this._latitudeInput.setAttribute('type', 'number'); | 81 this._latitudeInput.setAttribute('type', 'number'); |
| 81 this._latitudeInput.value = 0; | 82 this._latitudeInput.value = 0; |
| 82 this._latitudeSetter = UI.bindInput( | 83 this._latitudeSetter = UI.bindInput( |
| 83 this._latitudeInput, this._applyGeolocationUserInput.bind(this), | 84 this._latitudeInput, this._applyGeolocationUserInput.bind(this), |
| 84 SDK.EmulationModel.Geolocation.latitudeValidator, true); | 85 SDK.EmulationModel.Geolocation.latitudeValidator, true); |
| 85 this._latitudeSetter(String(geolocation.latitude)); | 86 this._latitudeSetter(String(geolocation.latitude)); |
| 86 | 87 |
| 87 this._longitudeInput = longitudeGroup.createChild('input'); | 88 this._longitudeInput = longitudeGroup.createChild('input'); |
| 89 this._longitudeInput.setAttribute('step', 'any'); |
| 88 this._longitudeInput.setAttribute('type', 'number'); | 90 this._longitudeInput.setAttribute('type', 'number'); |
| 89 this._longitudeInput.value = 0; | 91 this._longitudeInput.value = 0; |
| 90 this._longitudeSetter = UI.bindInput( | 92 this._longitudeSetter = UI.bindInput( |
| 91 this._longitudeInput, this._applyGeolocationUserInput.bind(this), | 93 this._longitudeInput, this._applyGeolocationUserInput.bind(this), |
| 92 SDK.EmulationModel.Geolocation.longitudeValidator, true); | 94 SDK.EmulationModel.Geolocation.longitudeValidator, true); |
| 93 this._longitudeSetter(String(geolocation.longitude)); | 95 this._longitudeSetter(String(geolocation.longitude)); |
| 94 | 96 |
| 95 latitudeGroup.createChild('div', 'latlong-title').textContent = Common.UIStr
ing('Latitude'); | 97 latitudeGroup.createChild('div', 'latlong-title').textContent = Common.UIStr
ing('Latitude'); |
| 96 longitudeGroup.createChild('div', 'latlong-title').textContent = Common.UISt
ring('Longitude'); | 98 longitudeGroup.createChild('div', 'latlong-title').textContent = Common.UISt
ring('Longitude'); |
| 97 } | 99 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 /** | 306 /** |
| 305 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation | 307 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation |
| 306 * @return {!Element} | 308 * @return {!Element} |
| 307 */ | 309 */ |
| 308 _createDeviceOrientationOverrideElement(deviceOrientation) { | 310 _createDeviceOrientationOverrideElement(deviceOrientation) { |
| 309 var fieldsetElement = createElement('fieldset'); | 311 var fieldsetElement = createElement('fieldset'); |
| 310 fieldsetElement.classList.add('device-orientation-override-section'); | 312 fieldsetElement.classList.add('device-orientation-override-section'); |
| 311 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell
'); | 313 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell
'); |
| 312 | 314 |
| 313 this._alphaElement = createElement('input'); | 315 this._alphaElement = createElement('input'); |
| 316 this._alphaElement.setAttribute('step', 'any'); |
| 314 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, C
ommon.UIString('\u03B1 (alpha)')); | 317 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, C
ommon.UIString('\u03B1 (alpha)')); |
| 315 this._alphaSetter(String(deviceOrientation.alpha)); | 318 this._alphaSetter(String(deviceOrientation.alpha)); |
| 316 | 319 |
| 317 this._betaElement = createElement('input'); | 320 this._betaElement = createElement('input'); |
| 321 this._betaElement.setAttribute('step', 'any'); |
| 318 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Com
mon.UIString('\u03B2 (beta)')); | 322 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Com
mon.UIString('\u03B2 (beta)')); |
| 319 this._betaSetter(String(deviceOrientation.beta)); | 323 this._betaSetter(String(deviceOrientation.beta)); |
| 320 | 324 |
| 321 this._gammaElement = createElement('input'); | 325 this._gammaElement = createElement('input'); |
| 326 this._gammaElement.setAttribute('step', 'any'); |
| 322 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, C
ommon.UIString('\u03B3 (gamma)')); | 327 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, C
ommon.UIString('\u03B3 (gamma)')); |
| 323 this._gammaSetter(String(deviceOrientation.gamma)); | 328 this._gammaSetter(String(deviceOrientation.gamma)); |
| 324 | 329 |
| 325 cellElement.appendChild(UI.createTextButton( | 330 cellElement.appendChild(UI.createTextButton( |
| 326 Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orie
ntation-reset-button')); | 331 Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orie
ntation-reset-button')); |
| 327 return fieldsetElement; | 332 return fieldsetElement; |
| 328 } | 333 } |
| 329 | 334 |
| 330 /** | 335 /** |
| 331 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation | 336 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 * @param {string} actionId | 502 * @param {string} actionId |
| 498 * @return {boolean} | 503 * @return {boolean} |
| 499 */ | 504 */ |
| 500 handleAction(context, actionId) { | 505 handleAction(context, actionId) { |
| 501 UI.viewManager.showView('sensors'); | 506 UI.viewManager.showView('sensors'); |
| 502 return true; | 507 return true; |
| 503 } | 508 } |
| 504 }; | 509 }; |
| 505 | 510 |
| 506 Emulation.SensorsView.ShiftDragOrientationSpeed = 16; | 511 Emulation.SensorsView.ShiftDragOrientationSpeed = 16; |
| OLD | NEW |