Chromium Code Reviews| 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 ce1b792f877b67956a79ee4fe46c0b9198421eb4..c91e1edcac5d288e9eca9f7333725b55d38ec607 100644 |
| --- a/chrome/browser/resources/vr_shell/vr_shell_ui.js |
| +++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js |
| @@ -453,19 +453,68 @@ var vrShellUi = (function() { |
| ui.flush(); |
| } |
| }; |
| + |
| + class Background { |
| + constructor() { |
| + // Make ground plane. |
| + let groundPlane = new api.UiElementUpdate(); |
| + groundPlane.setVisible(true); |
| + groundPlane.setSize(25.0, 25.0); |
| + groundPlane.setFill(new api.OpaqueGradient({r: 0.48, g: 0.48, b: 0.48, a:1}, |
| + {r: 0.57, g: 0.57, b: 0.57, a:1})); |
| + groundPlane.setTranslation(0, -2, 0); |
| + groundPlane.setRotation(1.0, 0.0, 0.0, -Math.PI/2); |
| + this.groundPlaneId = ui.addElement(groundPlane); |
| + |
| + // Make ceiling plane. |
| + let ceilingPlane = new api.UiElementUpdate(); |
| + ceilingPlane.setVisible(true); |
| + ceilingPlane.setSize(25.0, 25.0); |
| + ceilingPlane.setFill(new api.OpaqueGradient({r: 0.48, g: 0.48, b: 0.48, a:1}, |
| + {r: 0.57, g: 0.57, b: 0.57, a:1})); |
| + ceilingPlane.setTranslation(0, 2, 0); |
| + ceilingPlane.setRotation(1.0, 0.0, 0.0, Math.PI/2); |
| + this.ceilingPlaneId = ui.addElement(ceilingPlane); |
| + |
| + // Ground grid. |
| + let groundGrid = new api.UiElementUpdate(); |
| + groundGrid.setVisible(true); |
| + groundGrid.setSize(25.0, 25.0); |
| + groundGrid.setFill(new api.GridGradient({r: 0.57, g: 0.57, b: 0.57, a:1}, |
| + {r: 0.57, g: 0.57, b: 0.57, a:1}, 10)); |
| + groundGrid.setTranslation(0, -1.99, 0); |
| + groundGrid.setRotation(1.0, 0.0, 0.0, -Math.PI/2); |
| + this.groundGridId = ui.addElement(groundGrid); |
| + } |
| + |
| + setEnabled(enabled) { |
| + let groundPlaneUpdate = new api.UiElementUpdate(); |
| + groundPlaneUpdate.setVisible(enabled); |
| + ui.updateElement(this.groundPlaneId, groundPlaneUpdate); |
| + let ceilingPlaneUpdate = new api.UiElementUpdate(); |
| + ceilingPlaneUpdate.setVisible(enabled); |
| + ui.updateElement(this.ceilingPlaneId, ceilingPlaneUpdate); |
| + let groundGridUpdate = new api.UiElementUpdate(); |
| + groundGridUpdate.setVisible(enabled); |
| + ui.updateElement(this.groundGridId, groundGridUpdate); |
| + } |
| + }; |
| class UiManager { |
| constructor() { |
| this.mode = api.Mode.UNKNOWN; |
| this.menuMode = false; |
| this.fullscreen = false; |
| - |
| + |
|
mthiesse
2017/01/31 20:54:54
nit: whitespace here and below
tiborg1
2017/02/01 00:22:18
Done.
|
| + this.background = new Background(); |
| this.contentQuad = new ContentQuad(); |
| let contentId = this.contentQuad.getElementId(); |
| this.controls = new Controls(contentId); |
| this.secureOriginWarnings = new SecureOriginWarnings(); |
| this.urlIndicator = new UrlIndicator(); |
| + |
| + |
| } |
| setMode(mode, menuMode, fullscreen) { |
| @@ -487,6 +536,7 @@ var vrShellUi = (function() { |
| 0 : |
| URL_INDICATOR_VISIBILITY_TIMEOUT_MS); |
| this.secureOriginWarnings.setEnabled(mode == api.Mode.WEB_VR); |
| + this.background.setEnabled(mode == api.Mode.STANDARD && !menuMode); |
| api.setUiCssSize( |
| uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR); |