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

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: Tweaks. 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 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 api.Fill = class { 132 api.Fill = class {
133 constructor(type) { 133 constructor(type) {
134 this.properties = {}; 134 this.properties = {};
135 this.properties['fillType'] = type; 135 this.properties['fillType'] = type;
136 } 136 }
137 } 137 }
138 138
139 api.Sprite = class extends api.Fill { 139 api.Sprite = class extends api.Fill {
140 constructor(pixelX, pixelY, pixelWidth, pixelHeight) { 140 constructor(pixelX, pixelY, pixelWidth, pixelHeight) {
141 super(api.FillType.SPRITE); 141 super(api.FillType.SPRITE);
142 this.properties.copyRect = 142 this.properties['copyRectX'] = pixelX;
143 {x: pixelX, y: pixelY, width: pixelWidth, height: pixelHeight}; 143 this.properties['copyRectY'] = pixelY;
144 this.properties['copyRectWidth'] = pixelWidth;
145 this.properties['copyRectHeight'] = pixelHeight;
144 } 146 }
145 } 147 }
146 148
147 api.OpaqueGradient = class extends api.Fill { 149 api.OpaqueGradient = class extends api.Fill {
148 constructor(edgeColor, centerColor) { 150 constructor(edgeColor, centerColor) {
149 super(api.FillType.OPAQUE_GRADIENT); 151 super(api.FillType.OPAQUE_GRADIENT);
150 this.properties.edgeColor = edgeColor; 152 this.properties.edgeColor = edgeColor;
151 this.properties.centerColor = centerColor; 153 this.properties.centerColor = centerColor;
152 } 154 }
153 } 155 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 setParentId(id) { 198 setParentId(id) {
197 this.properties['parentId'] = id; 199 this.properties['parentId'] = id;
198 } 200 }
199 201
200 /** 202 /**
201 * Specify the width and height (in meters) of an element. 203 * Specify the width and height (in meters) of an element.
202 * @param {number} x 204 * @param {number} x
203 * @param {number} y 205 * @param {number} y
204 */ 206 */
205 setSize(x, y) { 207 setSize(x, y) {
206 this.properties['size'] = {x: x, y: y}; 208 this.properties['sizeX'] = x;
209 this.properties['sizeY'] = y;
207 } 210 }
208 211
209 /** 212 /**
210 * Specify optional scaling of the element, and any children. 213 * Specify optional scaling of the element, and any children.
211 * @param {number} x 214 * @param {number} x
212 * @param {number} y 215 * @param {number} y
213 * @param {number} z 216 * @param {number} z
214 */ 217 */
215 setScale(x, y, z) { 218 setScale(x, y, z) {
216 this.properties['scale'] = {x: x, y: y, z: z}; 219 this.properties['scaleX'] = x;
220 this.properties['scaleY'] = y;
221 this.properties['scaleZ'] = z;
217 } 222 }
218 223
219 /** 224 /**
220 * Specify rotation for the element. The rotation is specified in axis-angle 225 * Specify rotation for the element. The rotation is specified in axis-angle
221 * representation (rotate around unit vector [x, y, z] by 'a' radians). 226 * representation (rotate around unit vector [x, y, z] by 'a' radians).
222 * @param {number} x 227 * @param {number} x
223 * @param {number} y 228 * @param {number} y
224 * @param {number} z 229 * @param {number} z
225 * @param {number} a 230 * @param {number} a
226 */ 231 */
227 setRotation(x, y, z, a) { 232 setRotation(x, y, z, a) {
228 this.properties['rotation'] = {x: x, y: y, z: z, a: a}; 233 this.properties['rotationX'] = x;
234 this.properties['rotationY'] = y;
235 this.properties['rotationZ'] = z;
236 this.properties['rotationAngle'] = a;
229 } 237 }
230 238
231 /** 239 /**
232 * Specify the translation of the element. If anchoring is specified, the 240 * Specify the translation of the element. If anchoring is specified, the
233 * offset is applied to the anchoring position rather than the origin. 241 * offset is applied to the anchoring position rather than the origin.
234 * Translation is applied after scaling and rotation. 242 * Translation is applied after scaling and rotation.
235 * @param {number} x 243 * @param {number} x
236 * @param {number} y 244 * @param {number} y
237 * @param {number} z 245 * @param {number} z
238 */ 246 */
239 setTranslation(x, y, z) { 247 setTranslation(x, y, z) {
240 this.properties['translation'] = {x: x, y: y, z: z}; 248 this.properties['translationX'] = x;
249 this.properties['translationY'] = y;
250 this.properties['translationZ'] = z;
241 } 251 }
242 252
243 /** 253 /**
244 * Anchoring allows a rectangle to be positioned relative to the edge of 254 * Anchoring allows a rectangle to be positioned relative to the edge of
245 * its parent, without being concerned about the size of the parent. 255 * its parent, without being concerned about the size of the parent.
246 * Values should be XAnchoring and YAnchoring elements. 256 * Values should be XAnchoring and YAnchoring elements.
247 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM); 257 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM);
248 * @param {number} x 258 * @param {number} x
249 * @param {number} y 259 * @param {number} y
250 */ 260 */
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 if ('updateTab' in dict) { 593 if ('updateTab' in dict) {
584 this.onUpdateTab(dict['updateTabs']); 594 this.onUpdateTab(dict['updateTabs']);
585 } 595 }
586 if ('removeTab' in dict) { 596 if ('removeTab' in dict) {
587 this.onRemoveTab(dict['removeTab']); 597 this.onRemoveTab(dict['removeTab']);
588 } 598 }
589 599
590 this.onCommandHandlerFinished() 600 this.onCommandHandlerFinished()
591 } 601 }
592 }; 602 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698