Chromium Code Reviews| 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 /** | 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 this._geolocation.apply(); | 124 this._geolocation.apply(); |
| 125 } else { | 125 } else { |
| 126 this._geolocation.clear(); | 126 this._geolocation.clear(); |
| 127 } | 127 } |
| 128 }, | 128 }, |
| 129 | 129 |
| 130 _createDeviceOrientationSection: function() | 130 _createDeviceOrientationSection: function() |
| 131 { | 131 { |
| 132 var orientationGroup = this.contentElement.createChild("section", "senso rs-group"); | 132 var orientationGroup = this.contentElement.createChild("section", "senso rs-group"); |
| 133 orientationGroup.createChild("div", "sensors-group-title").textContent = WebInspector.UIString("Accelerometer"); | 133 orientationGroup.createChild("div", "sensors-group-title").textContent = WebInspector.UIString("Accelerometer"); |
| 134 var fields = orientationGroup.createChild("div", "geo-fields"); | 134 var orientationContent = orientationGroup.createChild("div", "orientatio n-content"); |
| 135 var fields = orientationContent.createChild("div", "orientation-fields") ; | |
| 135 | 136 |
| 136 const accelerometerOffOption = {title: WebInspector.UIString("Off"), ori entation: WebInspector.SensorsView.NonPresetOptions.NoOverride}; | 137 const accelerometerOffOption = {title: WebInspector.UIString("Off"), ori entation: WebInspector.SensorsView.NonPresetOptions.NoOverride}; |
| 137 const customOrientationOption = {title: WebInspector.UIString("Custom or ientation..."), orientation: WebInspector.SensorsView.NonPresetOptions.Custom}; | 138 const customOrientationOption = {title: WebInspector.UIString("Custom or ientation..."), orientation: WebInspector.SensorsView.NonPresetOptions.Custom}; |
| 138 this._orientationSelectElement = this.contentElement.createChild("select ", "chrome-select"); | 139 this._orientationSelectElement = this.contentElement.createChild("select ", "chrome-select"); |
| 139 this._orientationSelectElement.appendChild(new Option(accelerometerOffOp tion.title, accelerometerOffOption.orientation)); | 140 this._orientationSelectElement.appendChild(new Option(accelerometerOffOp tion.title, accelerometerOffOption.orientation)); |
| 140 this._orientationSelectElement.appendChild(new Option(customOrientationO ption.title, customOrientationOption.orientation)); | 141 this._orientationSelectElement.appendChild(new Option(customOrientationO ption.title, customOrientationOption.orientation)); |
| 141 | 142 |
| 142 var orientationGroups = WebInspector.SensorsView.PresetOrientations; | 143 var orientationGroups = WebInspector.SensorsView.PresetOrientations; |
| 143 for (var i = 0; i < orientationGroups.length; ++i) { | 144 for (var i = 0; i < orientationGroups.length; ++i) { |
| 144 var groupElement = this._orientationSelectElement.createChild("optgr oup"); | 145 var groupElement = this._orientationSelectElement.createChild("optgr oup"); |
| 145 groupElement.label = orientationGroups[i].title; | 146 groupElement.label = orientationGroups[i].title; |
| 146 var group = orientationGroups[i].value; | 147 var group = orientationGroups[i].value; |
| 147 for (var j = 0; j < group.length; ++j) | 148 for (var j = 0; j < group.length; ++j) |
| 148 groupElement.appendChild(new Option(group[j].title, group[j].ori entation)); | 149 groupElement.appendChild(new Option(group[j].title, group[j].ori entation)); |
| 149 } | 150 } |
| 150 this._orientationSelectElement.selectedIndex = 0; | 151 this._orientationSelectElement.selectedIndex = 0; |
| 151 fields.appendChild(this._orientationSelectElement); | 152 fields.appendChild(this._orientationSelectElement); |
| 152 this._orientationSelectElement.addEventListener("change", this._orientat ionSelectChanged.bind(this)); | 153 this._orientationSelectElement.addEventListener("change", this._orientat ionSelectChanged.bind(this)); |
| 153 | 154 |
| 154 this._deviceOrientationFieldset = this._createDeviceOrientationOverrideE lement(this._deviceOrientation); | 155 this._deviceOrientationFieldset = this._createDeviceOrientationOverrideE lement(this._deviceOrientation); |
| 155 this._deviceOrientationFieldset.disabled = true; | 156 |
| 157 this._stageElement = orientationContent.createChild("div", "acceleromete r-stage"); | |
| 158 this._stageElement.title = WebInspector.UIString("shift+drag to rotate a round the z-axis"); | |
| 159 this._boxElement = this._stageElement.createChild("section", "accelerome ter-box accelerometer-element"); | |
| 160 | |
| 161 this._boxElement.createChild("section", "accelerometer-front acceleromet er-element"); | |
| 162 this._boxElement.createChild("section", "accelerometer-top accelerometer -element"); | |
| 163 this._boxElement.createChild("section", "accelerometer-back acceleromete r-element"); | |
| 164 this._boxElement.createChild("section", "accelerometer-left acceleromete r-element"); | |
| 165 this._boxElement.createChild("section", "accelerometer-right acceleromet er-element"); | |
| 166 this._boxElement.createChild("section", "accelerometer-bottom accelerome ter-element"); | |
| 167 | |
| 168 WebInspector.installDragHandle(this._stageElement, this._onBoxDragStart. bind(this), this._onBoxDrag.bind(this), this._onBoxDragEnd.bind(this), "-webkit- grabbing", "-webkit-grab"); | |
| 169 | |
| 156 fields.appendChild(this._deviceOrientationFieldset); | 170 fields.appendChild(this._deviceOrientationFieldset); |
| 171 this._enableOrientationFields(true); | |
| 172 this._setBoxOrientation(this._deviceOrientation); | |
| 173 }, | |
| 174 | |
| 175 /** | |
| 176 * @param {?boolean} disable | |
| 177 */ | |
| 178 _enableOrientationFields: function(disable) | |
| 179 { | |
| 180 if (disable) { | |
| 181 this._deviceOrientationFieldset.disabled = true; | |
| 182 this._stageElement.classList.add("disabled"); | |
| 183 } else { | |
| 184 this._deviceOrientationFieldset.disabled = false; | |
| 185 this._stageElement.classList.remove("disabled"); | |
| 186 } | |
| 157 }, | 187 }, |
| 158 | 188 |
| 159 _orientationSelectChanged: function() | 189 _orientationSelectChanged: function() |
| 160 { | 190 { |
| 161 var value = this._orientationSelectElement.options[this._orientationSele ctElement.selectedIndex].value; | 191 var value = this._orientationSelectElement.options[this._orientationSele ctElement.selectedIndex].value; |
| 162 this._deviceOrientationFieldset.disabled = false; | 192 this._enableOrientationFields(false); |
| 163 | 193 |
| 164 if (value === WebInspector.SensorsView.NonPresetOptions.NoOverride) { | 194 if (value === WebInspector.SensorsView.NonPresetOptions.NoOverride) { |
| 165 this._deviceOrientationOverrideEnabled = false; | 195 this._deviceOrientationOverrideEnabled = false; |
| 166 this._deviceOrientationFieldset.disabled = true; | 196 this._enableOrientationFields(true); |
| 167 } else if (value === WebInspector.SensorsView.NonPresetOptions.Custom) { | 197 } else if (value === WebInspector.SensorsView.NonPresetOptions.Custom) { |
| 168 this._deviceOrientationOverrideEnabled = true; | 198 this._deviceOrientationOverrideEnabled = true; |
| 169 this._alphaElement.focus(); | 199 this._alphaElement.focus(); |
| 170 } else { | 200 } else { |
| 171 var parsedValue = JSON.parse(value); | 201 var parsedValue = JSON.parse(value); |
| 172 this._deviceOrientationOverrideEnabled = true; | 202 this._deviceOrientationOverrideEnabled = true; |
| 173 this._deviceOrientation = new WebInspector.DeviceOrientation(parsedV alue[0], parsedValue[1], parsedValue[2]); | 203 this._deviceOrientation = new WebInspector.DeviceOrientation(parsedV alue[0], parsedValue[1], parsedValue[2]); |
| 174 this._setDeviceOrientation(this._deviceOrientation, WebInspector.Sen sorsView.DeviceOrientationModificationSource.SelectPreset); | 204 this._setDeviceOrientation(this._deviceOrientation, WebInspector.Sen sorsView.DeviceOrientationModificationSource.SelectPreset); |
| 175 } | 205 } |
| 176 }, | 206 }, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 196 }, | 226 }, |
| 197 | 227 |
| 198 _applyDeviceOrientationUserInput: function() | 228 _applyDeviceOrientationUserInput: function() |
| 199 { | 229 { |
| 200 this._setDeviceOrientation(WebInspector.DeviceOrientation.parseUserInput (this._alphaElement.value.trim(), this._betaElement.value.trim(), this._gammaEle ment.value.trim()), WebInspector.SensorsView.DeviceOrientationModificationSource .UserInput); | 230 this._setDeviceOrientation(WebInspector.DeviceOrientation.parseUserInput (this._alphaElement.value.trim(), this._betaElement.value.trim(), this._gammaEle ment.value.trim()), WebInspector.SensorsView.DeviceOrientationModificationSource .UserInput); |
| 201 this._setSelectElementLabel(this._orientationSelectElement, WebInspector .SensorsView.NonPresetOptions.Custom); | 231 this._setSelectElementLabel(this._orientationSelectElement, WebInspector .SensorsView.NonPresetOptions.Custom); |
| 202 }, | 232 }, |
| 203 | 233 |
| 204 _resetDeviceOrientation: function() | 234 _resetDeviceOrientation: function() |
| 205 { | 235 { |
| 206 this._setDeviceOrientation(new WebInspector.DeviceOrientation(0, 0, 0), WebInspector.SensorsView.DeviceOrientationModificationSource.ResetButton); | 236 this._setDeviceOrientation(new WebInspector.DeviceOrientation(0, 90, 0), WebInspector.SensorsView.DeviceOrientationModificationSource.ResetButton); |
| 207 this._setSelectElementLabel(this._orientationSelectElement, "[0, 0, 0]") ; | 237 this._setSelectElementLabel(this._orientationSelectElement, "[0, 90, 0]" ); |
| 208 }, | 238 }, |
| 209 | 239 |
| 210 /** | 240 /** |
| 211 * @param {?WebInspector.DeviceOrientation} deviceOrientation | 241 * @param {?WebInspector.DeviceOrientation} deviceOrientation |
| 212 * @param {!WebInspector.SensorsView.DeviceOrientationModificationSource} mo dificationSource | 242 * @param {!WebInspector.SensorsView.DeviceOrientationModificationSource} mo dificationSource |
| 213 */ | 243 */ |
| 214 _setDeviceOrientation: function(deviceOrientation, modificationSource) | 244 _setDeviceOrientation: function(deviceOrientation, modificationSource) |
| 215 { | 245 { |
| 216 if (!deviceOrientation) | 246 if (!deviceOrientation) |
| 217 return; | 247 return; |
| 218 | 248 |
| 219 /** | 249 /** |
| 220 * @param {number} angle | 250 * @param {number} angle |
| 221 * @return {number} | 251 * @return {number} |
| 222 */ | 252 */ |
| 223 function roundAngle(angle) | 253 function roundAngle(angle) |
| 224 { | 254 { |
| 225 return Math.round(angle*10000)/10000; | 255 return Math.round(angle*10000)/10000; |
| 226 } | 256 } |
| 227 | 257 |
| 228 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserInput) { | 258 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserInput) { |
| 229 this._alphaSetter(roundAngle(deviceOrientation.alpha)); | 259 this._alphaSetter(roundAngle(deviceOrientation.alpha)); |
| 230 this._betaSetter(roundAngle(deviceOrientation.beta)); | 260 this._betaSetter(roundAngle(deviceOrientation.beta)); |
| 231 this._gammaSetter(roundAngle(deviceOrientation.gamma)); | 261 this._gammaSetter(roundAngle(deviceOrientation.gamma)); |
| 232 } | 262 } |
| 233 | 263 |
| 234 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserDrag) | 264 if (modificationSource != WebInspector.SensorsView.DeviceOrientationModi ficationSource.UserDrag) |
| 235 this._setBoxOrientation(deviceOrientation); | 265 this._setBoxOrientation(deviceOrientation); |
| 236 else | 266 else |
| 237 this._boxElement.classList.remove("smooth-transition"); | 267 this._boxElement.classList.remove("is-animating"); |
| 238 | 268 |
| 239 this._deviceOrientation = deviceOrientation; | 269 this._deviceOrientation = deviceOrientation; |
| 240 this._applyDeviceOrientation(); | 270 this._applyDeviceOrientation(); |
| 241 }, | 271 }, |
| 242 | 272 |
| 243 /** | 273 /** |
| 244 * @param {!Element} parentElement | 274 * @param {!Element} parentElement |
| 245 * @param {!Element} input | 275 * @param {!Element} input |
| 246 * @param {string} label | 276 * @param {string} label |
| 247 * @return {function(string)} | 277 * @return {function(string)} |
| 248 */ | 278 */ |
| 249 _createAxisInput: function(parentElement, input, label) | 279 _createAxisInput: function(parentElement, input, label) |
| 250 { | 280 { |
| 251 var div = parentElement.createChild("div", "accelerometer-axis-input-con tainer"); | 281 var div = parentElement.createChild("div", "accelerometer-axis-input-con tainer"); |
| 252 div.appendChild(input); | 282 div.appendChild(input); |
| 253 div.createTextChild(label); | 283 div.createTextChild(label); |
| 254 input.type = "number"; | 284 input.type = "number"; |
| 255 return WebInspector.bindInput(input, this._applyDeviceOrientationUserInp ut.bind(this), WebInspector.DeviceOrientation.validator, true); | 285 return WebInspector.bindInput(input, this._applyDeviceOrientationUserInp ut.bind(this), WebInspector.DeviceOrientation.validator, true); |
| 256 }, | 286 }, |
| 257 | 287 |
| 258 /** | 288 /** |
| 259 * @param {!WebInspector.DeviceOrientation} deviceOrientation | 289 * @param {!WebInspector.DeviceOrientation} deviceOrientation |
| 260 * @return {!Element} | 290 * @return {!Element} |
| 261 */ | 291 */ |
| 262 _createDeviceOrientationOverrideElement: function(deviceOrientation) | 292 _createDeviceOrientationOverrideElement: function(deviceOrientation) |
| 263 { | 293 { |
| 264 var fieldsetElement = createElement("fieldset"); | 294 var fieldsetElement = createElement("fieldset"); |
| 265 fieldsetElement.classList.add("device-orientation-override-section"); | 295 fieldsetElement.classList.add("device-orientation-override-section"); |
| 266 var tableElement = fieldsetElement.createChild("table"); | 296 var cellElement = fieldsetElement.createChild("td", "accelerometer-input s-cell"); |
| 267 var rowElement = tableElement.createChild("tr"); | |
| 268 var cellElement = rowElement.createChild("td", "accelerometer-inputs-cel l"); | |
| 269 | 297 |
| 270 this._alphaElement = createElement("input"); | 298 this._alphaElement = createElement("input"); |
| 271 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElemen t, WebInspector.UIString("\u03B1 (alpha)")); | 299 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElemen t, WebInspector.UIString("\u03B1 (alpha)")); |
| 272 this._alphaSetter(String(deviceOrientation.alpha)); | 300 this._alphaSetter(String(deviceOrientation.alpha)); |
| 273 | 301 |
| 274 this._betaElement = createElement("input"); | 302 this._betaElement = createElement("input"); |
| 275 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, WebInspector.UIString("\u03B2 (beta)")); | 303 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, WebInspector.UIString("\u03B2 (beta)")); |
| 276 this._betaSetter(String(deviceOrientation.beta)); | 304 this._betaSetter(String(deviceOrientation.beta)); |
| 277 | 305 |
| 278 this._gammaElement = createElement("input"); | 306 this._gammaElement = createElement("input"); |
| 279 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElemen t, WebInspector.UIString("\u03B3 (gamma)")); | 307 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElemen t, WebInspector.UIString("\u03B3 (gamma)")); |
| 280 this._gammaSetter(String(deviceOrientation.gamma)); | 308 this._gammaSetter(String(deviceOrientation.gamma)); |
| 281 | 309 |
| 282 cellElement.appendChild(createTextButton(WebInspector.UIString("Reset"), this._resetDeviceOrientation.bind(this), "accelerometer-reset-button")); | 310 cellElement.appendChild(createTextButton(WebInspector.UIString("Reset"), this._resetDeviceOrientation.bind(this), "accelerometer-reset-button")); |
| 283 | |
| 284 this._stageElement = rowElement.createChild("td","accelerometer-stage"); | |
| 285 this._boxElement = this._stageElement.createChild("section", "accelerome ter-box"); | |
| 286 | |
| 287 this._boxElement.createChild("section", "front"); | |
| 288 this._boxElement.createChild("section", "top"); | |
| 289 this._boxElement.createChild("section", "back"); | |
| 290 this._boxElement.createChild("section", "left"); | |
| 291 this._boxElement.createChild("section", "right"); | |
| 292 this._boxElement.createChild("section", "bottom"); | |
| 293 | |
| 294 WebInspector.installDragHandle(this._stageElement, this._onBoxDragStart. bind(this), this._onBoxDrag.bind(this), this._onBoxDragEnd.bind(this), "-webkit- grabbing", "-webkit-grab"); | |
| 295 this._setBoxOrientation(deviceOrientation); | |
| 296 return fieldsetElement; | 311 return fieldsetElement; |
| 297 }, | 312 }, |
| 298 | 313 |
| 299 /** | 314 /** |
| 300 * @param {!WebInspector.DeviceOrientation} deviceOrientation | 315 * @param {!WebInspector.DeviceOrientation} deviceOrientation |
| 301 */ | 316 */ |
| 302 _setBoxOrientation: function(deviceOrientation) | 317 _setBoxOrientation: function(deviceOrientation) |
| 303 { | 318 { |
| 304 var matrix = new WebKitCSSMatrix(); | 319 var matrix = new WebKitCSSMatrix(); |
| 305 this._boxMatrix = matrix.rotate(-deviceOrientation.beta, deviceOrientati on.gamma, -deviceOrientation.alpha); | 320 this._boxMatrix = matrix.rotate(90-deviceOrientation.beta, deviceOrienta tion.gamma, -deviceOrientation.alpha); |
| 306 this._boxElement.classList.add("smooth-transition"); | 321 this._boxElement.classList.add("is-animating"); |
| 307 this._boxElement.style.webkitTransform = this._boxMatrix.toString(); | 322 this._boxElement.style.webkitTransform = this._boxMatrix.toString(); |
|
PhistucK
2016/05/06 11:25:44
I understand you did not touch this, but can this
| |
| 308 }, | 323 }, |
| 309 | 324 |
| 310 /** | 325 /** |
| 311 * @param {!MouseEvent} event | 326 * @param {!MouseEvent} event |
| 312 * @return {boolean} | 327 * @return {boolean} |
| 313 */ | 328 */ |
| 314 _onBoxDrag: function(event) | 329 _onBoxDrag: function(event) |
| 315 { | 330 { |
| 316 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y); | 331 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y); |
| 317 if (!mouseMoveVector) | 332 if (!mouseMoveVector) |
| 318 return true; | 333 return true; |
| 319 | 334 |
| 320 event.consume(true); | 335 event.consume(true); |
| 321 var axis = WebInspector.Geometry.crossProduct(this._mouseDownVector, mou seMoveVector); | 336 var axis, angle; |
| 322 axis.normalize(); | 337 if (event.shiftKey) { |
| 323 var angle = WebInspector.Geometry.calculateAngle(this._mouseDownVector, mouseMoveVector); | 338 axis = new WebInspector.Geometry.Vector(0, 0, 1); |
| 339 angle = (this._mouseDownVector.x - mouseMoveVector.x)*WebInspector.S ensorsView.ShiftDragOrientationSpeed; | |
| 340 } else { | |
| 341 axis = WebInspector.Geometry.crossProduct(this._mouseDownVector, mou seMoveVector); | |
| 342 axis.normalize(); | |
| 343 angle = WebInspector.Geometry.calculateAngle(this._mouseDownVector, mouseMoveVector); | |
| 344 } | |
| 324 var matrix = new WebKitCSSMatrix(); | 345 var matrix = new WebKitCSSMatrix(); |
| 325 var rotationMatrix = matrix.rotateAxisAngle(axis.x, axis.y, axis.z, angl e); | 346 var rotationMatrix = matrix.rotateAxisAngle(axis.x, axis.y, axis.z, angl e); |
| 326 this._currentMatrix = rotationMatrix.multiply(this._boxMatrix); | 347 this._currentMatrix = rotationMatrix.multiply(this._boxMatrix); |
| 327 this._boxElement.style.webkitTransform = this._currentMatrix; | 348 |
| 349 var mat90 = new WebKitCSSMatrix(); | |
|
PhistucK
2016/05/06 11:25:44
It is so crucial to use WebKitCSSMatrix? Can this
| |
| 350 mat90.rotate(90); | |
| 351 this._boxElement.style.webkitTransform = mat90.multiply(this._currentMat rix); | |
|
PhistucK
2016/05/06 11:25:44
webkitTransform to transform
| |
| 328 var eulerAngles = WebInspector.Geometry.EulerAngles.fromRotationMatrix(t his._currentMatrix); | 352 var eulerAngles = WebInspector.Geometry.EulerAngles.fromRotationMatrix(t his._currentMatrix); |
| 329 var newOrientation = new WebInspector.DeviceOrientation(-eulerAngles.alp ha, -eulerAngles.beta, eulerAngles.gamma); | 353 var newOrientation = new WebInspector.DeviceOrientation(-eulerAngles.alp ha, -eulerAngles.beta, eulerAngles.gamma); |
| 330 this._setDeviceOrientation(newOrientation, WebInspector.SensorsView.Devi ceOrientationModificationSource.UserDrag); | 354 this._setDeviceOrientation(newOrientation, WebInspector.SensorsView.Devi ceOrientationModificationSource.UserDrag); |
| 331 this._setSelectElementLabel(this._orientationSelectElement, WebInspector .SensorsView.NonPresetOptions.Custom); | 355 this._setSelectElementLabel(this._orientationSelectElement, WebInspector .SensorsView.NonPresetOptions.Custom); |
| 332 return false; | 356 return false; |
| 333 }, | 357 }, |
| 334 | 358 |
| 335 /** | 359 /** |
| 336 * @param {!MouseEvent} event | 360 * @param {!MouseEvent} event |
| 337 * @return {boolean} | 361 * @return {boolean} |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 {title: WebInspector.UIString("Location unavailable"), location: Web Inspector.SensorsView.NonPresetOptions.Unavailable} | 455 {title: WebInspector.UIString("Location unavailable"), location: Web Inspector.SensorsView.NonPresetOptions.Unavailable} |
| 432 ] | 456 ] |
| 433 } | 457 } |
| 434 ] | 458 ] |
| 435 | 459 |
| 436 /** @type {!Array.<{title: string, value: !Array.<{title: string, orientation: ! WebInspector.DeviceOrientation}>}>} */ | 460 /** @type {!Array.<{title: string, value: !Array.<{title: string, orientation: ! WebInspector.DeviceOrientation}>}>} */ |
| 437 WebInspector.SensorsView.PresetOrientations = [ | 461 WebInspector.SensorsView.PresetOrientations = [ |
| 438 { | 462 { |
| 439 title: "Presets", | 463 title: "Presets", |
| 440 value: [ | 464 value: [ |
| 441 {title: WebInspector.UIString("Portrait"), orientation: "[0, 0, 0]"} , | 465 {title: WebInspector.UIString("Portrait"), orientation: "[0, 90, 0]" }, |
| 442 {title: WebInspector.UIString("Portrait upside down"), orientation: "[180, 0, 0]"}, | 466 {title: WebInspector.UIString("Portrait upside down"), orientation: "[180, 90, 0]"}, |
| 443 {title: WebInspector.UIString("Landscape left"), orientation: "[90, 0, 0]"}, | 467 {title: WebInspector.UIString("Landscape left"), orientation: "[90, 90, 0]"}, |
| 444 {title: WebInspector.UIString("Landscape right"), orientation: "[270 , 0, 0]"}, | 468 {title: WebInspector.UIString("Landscape right"), orientation: "[270 , 90, 0]"}, |
| 445 {title: WebInspector.UIString("Display up"), orientation: "[0, 270, 0]"}, | 469 {title: WebInspector.UIString("Display up"), orientation: "[0, 0, 0] "}, |
| 446 {title: WebInspector.UIString("Display down"), orientation: "[0, 90, 0]"} | 470 {title: WebInspector.UIString("Display down"), orientation: "[0, 180 , 0]"} |
| 447 ] | 471 ] |
| 448 } | 472 } |
| 449 ] | 473 ] |
| 450 | 474 |
| 451 /** | 475 /** |
| 452 * @return {!WebInspector.SensorsView} | 476 * @return {!WebInspector.SensorsView} |
| 453 */ | 477 */ |
| 454 WebInspector.SensorsView.instance = function() | 478 WebInspector.SensorsView.instance = function() |
| 455 { | 479 { |
| 456 if (!WebInspector.SensorsView._instanceObject) | 480 if (!WebInspector.SensorsView._instanceObject) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 472 * @param {!WebInspector.Context} context | 496 * @param {!WebInspector.Context} context |
| 473 * @param {string} actionId | 497 * @param {string} actionId |
| 474 * @return {boolean} | 498 * @return {boolean} |
| 475 */ | 499 */ |
| 476 handleAction: function(context, actionId) | 500 handleAction: function(context, actionId) |
| 477 { | 501 { |
| 478 WebInspector.inspectorView.showViewInDrawer("sensors"); | 502 WebInspector.inspectorView.showViewInDrawer("sensors"); |
| 479 return true; | 503 return true; |
| 480 } | 504 } |
| 481 } | 505 } |
| 506 | |
| 507 WebInspector.SensorsView.ShiftDragOrientationSpeed = 16; | |
| OLD | NEW |