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

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

Issue 2706343005: Allow individual UI element properties to be modified. (Closed)
Patch Set: Use a safer cast on integer conversions. 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/android/vr_shell/ui_scene_unittest.cc ('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 api = {}; 5 var api = {};
6 6
7 /** 7 /**
8 * Enumeration of scene update commands. 8 * Enumeration of scene update commands.
9 * @enum {number} 9 * @enum {number}
10 * @const 10 * @const
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 api.Fill = class { 136 api.Fill = class {
137 constructor(type) { 137 constructor(type) {
138 this.properties = {}; 138 this.properties = {};
139 this.properties['fillType'] = type; 139 this.properties['fillType'] = type;
140 } 140 }
141 } 141 }
142 142
143 api.Sprite = class extends api.Fill { 143 api.Sprite = class extends api.Fill {
144 constructor(pixelX, pixelY, pixelWidth, pixelHeight) { 144 constructor(pixelX, pixelY, pixelWidth, pixelHeight) {
145 super(api.FillType.SPRITE); 145 super(api.FillType.SPRITE);
146 this.properties.copyRect = 146 this.properties['copyRectX'] = pixelX;
147 {x: pixelX, y: pixelY, width: pixelWidth, height: pixelHeight}; 147 this.properties['copyRectY'] = pixelY;
148 this.properties['copyRectWidth'] = pixelWidth;
149 this.properties['copyRectHeight'] = pixelHeight;
148 } 150 }
149 } 151 }
150 152
151 api.OpaqueGradient = class extends api.Fill { 153 api.OpaqueGradient = class extends api.Fill {
152 constructor(edgeColor, centerColor) { 154 constructor(edgeColor, centerColor) {
153 super(api.FillType.OPAQUE_GRADIENT); 155 super(api.FillType.OPAQUE_GRADIENT);
154 this.properties.edgeColor = edgeColor; 156 this.properties.edgeColor = edgeColor;
155 this.properties.centerColor = centerColor; 157 this.properties.centerColor = centerColor;
156 } 158 }
157 } 159 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 setParentId(id) { 202 setParentId(id) {
201 this.properties['parentId'] = id; 203 this.properties['parentId'] = id;
202 } 204 }
203 205
204 /** 206 /**
205 * Specify the width and height (in meters) of an element. 207 * Specify the width and height (in meters) of an element.
206 * @param {number} x 208 * @param {number} x
207 * @param {number} y 209 * @param {number} y
208 */ 210 */
209 setSize(x, y) { 211 setSize(x, y) {
210 this.properties['size'] = {x: x, y: y}; 212 this.properties['sizeX'] = x;
213 this.properties['sizeY'] = y;
211 } 214 }
212 215
213 /** 216 /**
214 * Specify optional scaling of the element, and any children. 217 * Specify optional scaling of the element, and any children.
215 * @param {number} x 218 * @param {number} x
216 * @param {number} y 219 * @param {number} y
217 * @param {number} z 220 * @param {number} z
218 */ 221 */
219 setScale(x, y, z) { 222 setScale(x, y, z) {
220 this.properties['scale'] = {x: x, y: y, z: z}; 223 this.properties['scaleX'] = x;
224 this.properties['scaleY'] = y;
225 this.properties['scaleZ'] = z;
221 } 226 }
222 227
223 /** 228 /**
224 * Specify rotation for the element. The rotation is specified in axis-angle 229 * Specify rotation for the element. The rotation is specified in axis-angle
225 * representation (rotate around unit vector [x, y, z] by 'a' radians). 230 * representation (rotate around unit vector [x, y, z] by 'a' radians).
226 * @param {number} x 231 * @param {number} x
227 * @param {number} y 232 * @param {number} y
228 * @param {number} z 233 * @param {number} z
229 * @param {number} a 234 * @param {number} a
230 */ 235 */
231 setRotation(x, y, z, a) { 236 setRotation(x, y, z, a) {
232 this.properties['rotation'] = {x: x, y: y, z: z, a: a}; 237 this.properties['rotationX'] = x;
238 this.properties['rotationY'] = y;
239 this.properties['rotationZ'] = z;
240 this.properties['rotationAngle'] = a;
233 } 241 }
234 242
235 /** 243 /**
236 * Specify the translation of the element. If anchoring is specified, the 244 * Specify the translation of the element. If anchoring is specified, the
237 * offset is applied to the anchoring position rather than the origin. 245 * offset is applied to the anchoring position rather than the origin.
238 * Translation is applied after scaling and rotation. 246 * Translation is applied after scaling and rotation.
239 * @param {number} x 247 * @param {number} x
240 * @param {number} y 248 * @param {number} y
241 * @param {number} z 249 * @param {number} z
242 */ 250 */
243 setTranslation(x, y, z) { 251 setTranslation(x, y, z) {
244 this.properties['translation'] = {x: x, y: y, z: z}; 252 this.properties['translationX'] = x;
253 this.properties['translationY'] = y;
254 this.properties['translationZ'] = z;
245 } 255 }
246 256
247 /** 257 /**
248 * Anchoring allows a rectangle to be positioned relative to the edge of 258 * Anchoring allows a rectangle to be positioned relative to the edge of
249 * its parent, without being concerned about the size of the parent. 259 * its parent, without being concerned about the size of the parent.
250 * Values should be XAnchoring and YAnchoring elements. 260 * Values should be XAnchoring and YAnchoring elements.
251 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM); 261 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM);
252 * @param {number} x 262 * @param {number} x
253 * @param {number} y 263 * @param {number} y
254 */ 264 */
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if ('updateTab' in dict) { 654 if ('updateTab' in dict) {
645 this.onUpdateTab(dict['updateTab']); 655 this.onUpdateTab(dict['updateTab']);
646 } 656 }
647 if ('removeTab' in dict) { 657 if ('removeTab' in dict) {
648 this.onRemoveTab(dict['removeTab']); 658 this.onRemoveTab(dict['removeTab']);
649 } 659 }
650 660
651 this.onCommandHandlerFinished() 661 this.onCommandHandlerFinished()
652 } 662 }
653 }; 663 };
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698