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

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2442873002: Control the VrShell content quad via the HTML UI. (Closed)
Patch Set: Rebase; address nits and bug. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/resources/vr_shell/vr_shell_ui_api.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/vr_shell/vr_shell_ui.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js
index d2aab662d8232fcbe46538c0296a788fa26db966..3737d5ba34d2859af208d71013b0f5928ef47cf5 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -8,6 +8,30 @@ var vrShellUi = (function() {
let scene = new ui.Scene();
let sceneManager;
+ class ContentQuad {
+ constructor() {
+ /** @const */ var SCREEN_HEIGHT = 1.6;
+ /** @const */ var SCREEN_DISTANCE = 2.0;
+
+ let element = new api.UiElement(0, 0, 0, 0);
+ element.setIsContentQuad(false);
+ element.setVisible(false);
+ element.setSize(SCREEN_HEIGHT * 16 / 9, SCREEN_HEIGHT);
+ element.setTranslation(0, 0, -SCREEN_DISTANCE);
+ this.elementId = scene.addElement(element);
+ }
+
+ show(visible) {
+ let update = new api.UiElementUpdate();
+ update.setVisible(visible);
+ scene.updateElement(this.elementId, update);
+ }
+
+ getElementId() {
+ return this.elementId;
+ }
+ };
+
class DomUiElement {
constructor(domId) {
let domElement = document.querySelector(domId);
@@ -62,7 +86,7 @@ var vrShellUi = (function() {
};
class Controls {
- constructor() {
+ constructor(contentQuadId) {
this.buttons = [];
let descriptors = [
['#back', function() {
@@ -82,7 +106,7 @@ var vrShellUi = (function() {
for (let i = 0; i < descriptors.length; i++) {
// Use an invisible parent to simplify Z-axis movement on hover.
let position = new api.UiElement(0, 0, 0, 0);
- position.setParentId(api.getContentElementId());
+ position.setParentId(contentQuadId);
position.setVisible(false);
position.setAnchoring(api.XAnchoring.XNONE, api.YAnchoring.YBOTTOM);
position.setTranslation(
@@ -189,12 +213,17 @@ var vrShellUi = (function() {
class SceneManager {
constructor() {
this.mode = api.Mode.UNKNOWN;
- this.controls = new Controls();
+
+ this.contentQuad = new ContentQuad();
+ let contentId = this.contentQuad.getElementId();
+
+ this.controls = new Controls(contentId);
this.secureOriginWarnings = new SecureOriginWarnings();
}
setMode(mode) {
this.mode = mode;
+ this.contentQuad.show(mode == api.Mode.STANDARD);
this.controls.show(mode == api.Mode.STANDARD);
this.secureOriginWarnings.show(mode == api.Mode.WEB_VR);
}
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/resources/vr_shell/vr_shell_ui_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698