| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 var vrShellUi = (function() { | 5 var vrShellUi = (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 let ui = new scene.Scene(); | 8 let ui = new scene.Scene(); |
| 9 let uiManager; | 9 let uiManager; |
| 10 let nativeCommandHandler; | 10 let nativeCommandHandler; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 class ContentQuad { | 29 class ContentQuad { |
| 30 constructor() { | 30 constructor() { |
| 31 /** @const */ this.SCREEN_HEIGHT = 1.6; | 31 /** @const */ this.SCREEN_HEIGHT = 1.6; |
| 32 /** @const */ this.SCREEN_RATIO = 16 / 9; | 32 /** @const */ this.SCREEN_RATIO = 16 / 9; |
| 33 /** @const */ this.BROWSING_SCREEN_DISTANCE = 2.0; | 33 /** @const */ this.BROWSING_SCREEN_DISTANCE = 2.0; |
| 34 /** @const */ this.FULLSCREEN_DISTANCE = 3.0; | 34 /** @const */ this.FULLSCREEN_DISTANCE = 3.0; |
| 35 /** @const */ this.CSS_WIDTH_PIXELS = 960.0; | 35 /** @const */ this.CSS_WIDTH_PIXELS = 960.0; |
| 36 /** @const */ this.CSS_HEIGHT_PIXELS = 640.0; | 36 /** @const */ this.CSS_HEIGHT_PIXELS = 640.0; |
| 37 /** @const */ this.DPR = 1.2; | 37 /** @const */ this.DPR = 1.2; |
| 38 /** @const */ this.MENU_MODE_SCREEN_DISTANCE = 1.2; | 38 /** @const */ this.MENU_MODE_SCREEN_DISTANCE = 2.0; |
| 39 /** @const */ this.MENU_MODE_SCREEN_HEIGHT = 0.5; | 39 /** @const */ this.MENU_MODE_SCREEN_HEIGHT = 0.8; |
| 40 /** @const */ this.MENU_MODE_SCREEN_ELEVATION = 0.1; | 40 /** @const */ this.MENU_MODE_SCREEN_ELEVATION = 0.2; |
| 41 /** @const */ this.BACKGROUND_DISTANCE_MULTIPLIER = 1.414; | 41 /** @const */ this.BACKGROUND_DISTANCE_MULTIPLIER = 1.414; |
| 42 | 42 |
| 43 this.menuMode = false; | 43 this.menuMode = false; |
| 44 this.fullscreen = false; | 44 this.fullscreen = false; |
| 45 | 45 |
| 46 let element = new api.UiElement(0, 0, 0, 0); | 46 let element = new api.UiElement(0, 0, 0, 0); |
| 47 element.setFill(new api.Content()); | 47 element.setFill(new api.Content()); |
| 48 element.setVisible(false); | 48 element.setVisible(false); |
| 49 element.setSize( | 49 element.setSize( |
| 50 this.SCREEN_HEIGHT * this.SCREEN_RATIO, this.SCREEN_HEIGHT); | 50 this.SCREEN_HEIGHT * this.SCREEN_RATIO, this.SCREEN_HEIGHT); |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 this.buttonElements.forEach(function(buttonElement) { | 871 this.buttonElements.forEach(function(buttonElement) { |
| 872 let update = new api.UiElementUpdate(); | 872 let update = new api.UiElementUpdate(); |
| 873 update.setVisible(enabled); | 873 update.setVisible(enabled); |
| 874 ui.updateElement(buttonElement.id, update); | 874 ui.updateElement(buttonElement.id, update); |
| 875 }, this); | 875 }, this); |
| 876 } | 876 } |
| 877 }; | 877 }; |
| 878 | 878 |
| 879 class VirtualKeyboard { | 879 class VirtualKeyboard { |
| 880 constructor(contentQuadId) { | 880 constructor(contentQuadId) { |
| 881 /** @const */ this.SCENE_GROUND_SIZE = 25.0; | 881 /** @const */ this.SCALE = 1.4; |
| 882 /** @const */ this.SCALE = 1.8; | 882 /** @const */ this.ANGLE_UP = Math.PI / 8; |
| 883 /** @const */ this.ANGLE_UP = Math.PI / 6; | 883 /** @const */ this.Y_OFFSET = -0.9; |
| 884 /** @const */ this.Y_OFFSET = -1.0; | |
| 885 /** @const */ this.Z_OFFSET = -1.8; | 884 /** @const */ this.Z_OFFSET = -1.8; |
| 886 | 885 |
| 887 this.element = new DomUiElement('#vkb'); | 886 this.element = new DomUiElement('#vkb'); |
| 888 let update = new api.UiElementUpdate(); | 887 let update = new api.UiElementUpdate(); |
| 889 update.setVisible(true); | 888 update.setVisible(true); |
| 890 update.setOpacity(0); | 889 update.setOpacity(0); |
| 891 update.setRotation(1, 0, 0, -this.ANGLE_UP); | 890 update.setRotation(1, 0, 0, -this.ANGLE_UP); |
| 892 update.setScale(this.SCALE, this.SCALE, this.SCALE); | 891 update.setScale(this.SCALE, this.SCALE, this.SCALE); |
| 893 update.setTranslation(0, this.Y_OFFSET, this.Z_OFFSET); | 892 update.setTranslation(0, this.Y_OFFSET, this.Z_OFFSET); |
| 894 ui.updateElement(this.element.id, update); | 893 ui.updateElement(this.element.id, update); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 nativeCommandHandler.handleCommand(dict); | 1071 nativeCommandHandler.handleCommand(dict); |
| 1073 } | 1072 } |
| 1074 | 1073 |
| 1075 return { | 1074 return { |
| 1076 initialize: initialize, | 1075 initialize: initialize, |
| 1077 command: command, | 1076 command: command, |
| 1078 }; | 1077 }; |
| 1079 })(); | 1078 })(); |
| 1080 | 1079 |
| 1081 window.addEventListener('load', vrShellUi.initialize); | 1080 window.addEventListener('load', vrShellUi.initialize); |
| OLD | NEW |