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

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

Issue 2668093002: VrShell background implemented in JS. (Closed)
Patch Set: Fixed tests 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
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui_api.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 scene = {}; 5 var scene = {};
6 6
7 /** 7 /**
8 * The scene class assists in managing element and animations in the UI. It 8 * The scene class assists in managing element and animations in the UI. It
9 * allows UI update API commands to be queued in batches, and manages allocation 9 * allows UI update API commands to be queued in batches, and manages allocation
10 * of element and animation IDs. 10 * of element and animation IDs.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 /** 57 /**
58 * Flush all queued commands to native. 58 * Flush all queued commands to native.
59 */ 59 */
60 flush() { 60 flush() {
61 api.sendCommands(this.commands); 61 api.sendCommands(this.commands);
62 this.commands = []; 62 this.commands = [];
63 } 63 }
64 64
65 /** 65 /**
66 * Add a new UiElement to the scene, returning the ID assigned. 66 * Add a new UiElementUpdate to the scene, returning the ID assigned.
67 * @param {api.UiElement} element 67 * @param {api.UiElementUpdate} element
68 */ 68 */
69 addElement(element) { 69 addElement(element) {
70 var id = this.idIndex++; 70 var id = this.idIndex++;
71 element.setId(id); 71 element.setId(id);
72 this.commands.push( 72 this.commands.push(
73 {'type': api.Command.ADD_ELEMENT, 'data': element.properties}); 73 {'type': api.Command.ADD_ELEMENT, 'data': element.properties});
74 this.elements.add(id); 74 this.elements.add(id);
75 return id; 75 return id;
76 } 76 }
77 77
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 var id = parseInt(id_key, 10); 138 var id = parseInt(id_key, 10);
139 this.removeAnimation(id); 139 this.removeAnimation(id);
140 } 140 }
141 var ids = this.elements.values(); 141 var ids = this.elements.values();
142 for (let id of ids) { 142 for (let id of ids) {
143 this.removeElement(id); 143 this.removeElement(id);
144 } 144 }
145 this.flush(); 145 this.flush();
146 } 146 }
147 }; 147 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui_api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698