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

Side by Side Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2710593008: [VR Shell] Fix hidden elements being hit-testable. (Closed)
Patch Set: Fix closure compiler error Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
51 element.setTranslation(0, 0, -this.BROWSING_SCREEN_DISTANCE); 51 element.setTranslation(0, 0, -this.BROWSING_SCREEN_DISTANCE);
52 this.elementId = ui.addElement(element); 52 this.elementId = ui.addElement(element);
53 53
54 // Place an invisible but hittable plane behind the content quad, to keep 54 // Place an invisible (fill none) but hittable plane behind the content
55 // the reticle roughly planar with the content if near content. 55 // quad, to keep the reticle roughly planar with the content if near
56 // content.
56 let backPlane = new api.UiElement(0, 0, 0, 0); 57 let backPlane = new api.UiElement(0, 0, 0, 0);
57 backPlane.setVisible(false);
58 backPlane.setHitTestable(true);
59 backPlane.setSize(1000, 1000); 58 backPlane.setSize(1000, 1000);
60 backPlane.setTranslation(0, 0, -0.01); 59 backPlane.setTranslation(0, 0, -0.01);
61 backPlane.setParentId(this.elementId); 60 backPlane.setParentId(this.elementId);
61 backPlane.setFill(new api.NoFill());
62 ui.addElement(backPlane); 62 ui.addElement(backPlane);
63 63
64 this.updateState(); 64 this.updateState();
65 } 65 }
66 66
67 setEnabled(enabled) { 67 setEnabled(enabled) {
68 let update = new api.UiElementUpdate(); 68 let update = new api.UiElementUpdate();
69 update.setVisible(enabled); 69 update.setVisible(enabled);
70 ui.updateElement(this.elementId, update); 70 ui.updateElement(this.elementId, update);
71 if (enabled) { 71 if (enabled) {
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 nativeCommandHandler.handleCommand(dict); 968 nativeCommandHandler.handleCommand(dict);
969 } 969 }
970 970
971 return { 971 return {
972 initialize: initialize, 972 initialize: initialize,
973 command: command, 973 command: command,
974 }; 974 };
975 })(); 975 })();
976 976
977 window.addEventListener('load', vrShellUi.initialize); 977 window.addEventListener('load', vrShellUi.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements.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