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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 but hittable plane behind the content quad, to keep |
55 // the reticle roughly planar with the content if near content. | 55 // the reticle roughly planar with the content if near content. |
56 let backPlane = new api.UiElement(0, 0, 0, 0); | 56 let backPlane = new api.UiElement(0, 0, 0, 0); |
57 backPlane.setVisible(false); | 57 backPlane.setVisible(true); |
cjgrant
2017/02/24 14:25:23
Why not remove setVisible() and setHitTestable() c
mthiesse
2017/02/24 15:30:09
Done.
| |
58 backPlane.setHitTestable(true); | 58 backPlane.setHitTestable(true); |
59 backPlane.setSize(1000, 1000); | 59 backPlane.setSize(1000, 1000); |
60 backPlane.setTranslation(0, 0, -0.01); | 60 backPlane.setTranslation(0, 0, -0.01); |
61 backPlane.setParentId(this.elementId); | 61 backPlane.setParentId(this.elementId); |
62 backPlane.setFill(new api.Fill(api.FillType.None)); | |
62 ui.addElement(backPlane); | 63 ui.addElement(backPlane); |
63 | 64 |
64 this.updateState(); | 65 this.updateState(); |
65 } | 66 } |
66 | 67 |
67 setEnabled(enabled) { | 68 setEnabled(enabled) { |
68 let update = new api.UiElementUpdate(); | 69 let update = new api.UiElementUpdate(); |
69 update.setVisible(enabled); | 70 update.setVisible(enabled); |
70 ui.updateElement(this.elementId, update); | 71 ui.updateElement(this.elementId, update); |
71 if (enabled) { | 72 if (enabled) { |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
973 nativeCommandHandler.handleCommand(dict); | 974 nativeCommandHandler.handleCommand(dict); |
974 } | 975 } |
975 | 976 |
976 return { | 977 return { |
977 initialize: initialize, | 978 initialize: initialize, |
978 command: command, | 979 command: command, |
979 }; | 980 }; |
980 })(); | 981 })(); |
981 | 982 |
982 window.addEventListener('load', vrShellUi.initialize); | 983 window.addEventListener('load', vrShellUi.initialize); |
OLD | NEW |