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

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

Issue 2600683002: Run tools/clang-format-js on some of chrome/browser/resources/ (Closed)
Patch Set: event_handler.js Created 3 years, 12 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 = (function() { 5 var api = (function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Enumeration of scene update commands. 9 * Enumeration of scene update commands.
10 * @enum {number} 10 * @enum {number}
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 /** 38 /**
39 * Enumeration of valid Anchroing for X axis. 39 * Enumeration of valid Anchroing for X axis.
40 * An element can either be anchored to the left, right, or center of the main 40 * An element can either be anchored to the left, right, or center of the main
41 * content rect (or it can be absolutely positioned using NONE). Any 41 * content rect (or it can be absolutely positioned using NONE). Any
42 * translations applied will be relative to this anchoring. 42 * translations applied will be relative to this anchoring.
43 * @enum {number} 43 * @enum {number}
44 * @const 44 * @const
45 */ 45 */
46 var XAnchoring = Object.freeze({ 46 var XAnchoring = Object.freeze({'XNONE': 0, 'XLEFT': 1, 'XRIGHT': 2});
47 'XNONE': 0,
48 'XLEFT': 1,
49 'XRIGHT': 2
50 });
51 47
52 /** 48 /**
53 * Enumeration of valid Anchroing for Y axis. 49 * Enumeration of valid Anchroing for Y axis.
54 * @enum {number} 50 * @enum {number}
55 * @const 51 * @const
56 */ 52 */
57 var YAnchoring = Object.freeze({ 53 var YAnchoring = Object.freeze({'YNONE': 0, 'YTOP': 1, 'YBOTTOM': 2});
58 'YNONE': 0,
59 'YTOP': 1,
60 'YBOTTOM': 2
61 });
62 54
63 /** 55 /**
64 * Enumeration of actions that can be triggered by the HTML UI. 56 * Enumeration of actions that can be triggered by the HTML UI.
65 * @enum {number} 57 * @enum {number}
66 * @const 58 * @const
67 */ 59 */
68 var Action = Object.freeze({ 60 var Action = Object.freeze({
69 'HISTORY_BACK': 0, 61 'HISTORY_BACK': 0,
70 'HISTORY_FORWARD': 1, 62 'HISTORY_FORWARD': 1,
71 'RELOAD': 2, 63 'RELOAD': 2,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 function setUiCssSize(width, height, dpr) { 98 function setUiCssSize(width, height, dpr) {
107 chrome.send('setUiCssSize', [width, height, dpr]); 99 chrome.send('setUiCssSize', [width, height, dpr]);
108 } 100 }
109 101
110 /** 102 /**
111 * Represents updates to UI element properties. Any properties set on this 103 * Represents updates to UI element properties. Any properties set on this
112 * object are relayed to an underlying native element via scene command. 104 * object are relayed to an underlying native element via scene command.
113 * Properties that are not set on this object are left unchanged. 105 * Properties that are not set on this object are left unchanged.
114 */ 106 */
115 class UiElementUpdate { 107 class UiElementUpdate {
116
117 setIsContentQuad() { 108 setIsContentQuad() {
118 this.contentQuad = true; 109 this.contentQuad = true;
119 } 110 }
120 111
121 /** 112 /**
122 * Specify a parent for this element. If set, this element is positioned 113 * Specify a parent for this element. If set, this element is positioned
123 * relative to its parent element, rather than absolutely. This allows 114 * relative to its parent element, rather than absolutely. This allows
124 * elements to automatically move with a parent. 115 * elements to automatically move with a parent.
125 */ 116 */
126 setParentId(id) { 117 setParentId(id) {
127 this.parentId = id; 118 this.parentId = id;
128 } 119 }
129 120
130 /** 121 /**
131 * Specify the width and height (in meters) of an element. 122 * Specify the width and height (in meters) of an element.
132 */ 123 */
133 setSize(x, y) { 124 setSize(x, y) {
134 this.size = { x: x, y: y }; 125 this.size = {x: x, y: y};
135 } 126 }
136 127
137 /** 128 /**
138 * Specify optional scaling of the element, and any children. 129 * Specify optional scaling of the element, and any children.
139 */ 130 */
140 setScale(x, y, z) { 131 setScale(x, y, z) {
141 this.scale = { x: x, y: y, z: z }; 132 this.scale = {x: x, y: y, z: z};
142 } 133 }
143 134
144 /** 135 /**
145 * Specify rotation for the element. The rotation is specified in axis-angle 136 * Specify rotation for the element. The rotation is specified in axis-angle
146 * representation (rotate around unit vector [x, y, z] by 'a' radians). 137 * representation (rotate around unit vector [x, y, z] by 'a' radians).
147 */ 138 */
148 setRotation(x, y, z, a) { 139 setRotation(x, y, z, a) {
149 this.rotation = { x: x, y: y, z: z, a: a }; 140 this.rotation = {x: x, y: y, z: z, a: a};
150 } 141 }
151 142
152 /** 143 /**
153 * Specify the translation of the element. If anchoring is specified, the 144 * Specify the translation of the element. If anchoring is specified, the
154 * offset is applied to the anchoring position rather than the origin. 145 * offset is applied to the anchoring position rather than the origin.
155 * Translation is applied after scaling and rotation. 146 * Translation is applied after scaling and rotation.
156 */ 147 */
157 setTranslation(x, y, z) { 148 setTranslation(x, y, z) {
158 this.translation = { x: x, y: y, z: z }; 149 this.translation = {x: x, y: y, z: z};
159 } 150 }
160 151
161 /** 152 /**
162 * Anchoring allows a rectangle to be positioned relative to the edge of 153 * Anchoring allows a rectangle to be positioned relative to the edge of
163 * its parent, without being concerned about the size of the parent. 154 * its parent, without being concerned about the size of the parent.
164 * Values should be XAnchoring and YAnchoring elements. 155 * Values should be XAnchoring and YAnchoring elements.
165 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM); 156 * Example: element.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM);
166 */ 157 */
167 setAnchoring(x, y) { 158 setAnchoring(x, y) {
168 this.xAnchoring = x; 159 this.xAnchoring = x;
(...skipping 30 matching lines...) Expand all
199 class UiElement extends UiElementUpdate { 190 class UiElement extends UiElementUpdate {
200 /** 191 /**
201 * Constructor of UiElement. 192 * Constructor of UiElement.
202 * pixelX and pixelY values indicate the left upper corner; pixelWidth and 193 * pixelX and pixelY values indicate the left upper corner; pixelWidth and
203 * pixelHeight is width and height of the texture to be copied from the web 194 * pixelHeight is width and height of the texture to be copied from the web
204 * contents. 195 * contents.
205 */ 196 */
206 constructor(pixelX, pixelY, pixelWidth, pixelHeight) { 197 constructor(pixelX, pixelY, pixelWidth, pixelHeight) {
207 super(); 198 super();
208 199
209 this.copyRect = { 200 this.copyRect =
210 x: pixelX, 201 {x: pixelX, y: pixelY, width: pixelWidth, height: pixelHeight};
211 y: pixelY,
212 width: pixelWidth,
213 height: pixelHeight
214 };
215 } 202 }
216 }; 203 };
217 204
218 /** 205 /**
219 * Enumeration of animatable properties. 206 * Enumeration of animatable properties.
220 * @enum {number} 207 * @enum {number}
221 * @const 208 * @const
222 */ 209 */
223 var Property = Object.freeze({ 210 var Property = Object.freeze({
224 'COPYRECT': 0, 211 'COPYRECT': 0,
225 'SIZE': 1, 212 'SIZE': 1,
226 'TRANSLATION': 2, 213 'TRANSLATION': 2,
227 'ORIENTATION': 3, 214 'ORIENTATION': 3,
228 'ROTATION': 4 215 'ROTATION': 4
229 }); 216 });
230 217
231 /** 218 /**
232 * Enumeration of easing type. 219 * Enumeration of easing type.
233 * @enum {number} 220 * @enum {number}
234 * @const 221 * @const
235 */ 222 */
236 var Easing = Object.freeze({ 223 var Easing =
237 'LINEAR': 0, 224 Object.freeze({'LINEAR': 0, 'CUBICBEZIER': 1, 'EASEIN': 2, 'EASEOUT': 3});
238 'CUBICBEZIER': 1,
239 'EASEIN': 2,
240 'EASEOUT': 3
241 });
242 225
243 /** 226 /**
244 * Base animation class. An animation can vary only one object property. 227 * Base animation class. An animation can vary only one object property.
245 */ 228 */
246 class Animation { 229 class Animation {
247 constructor(elementId, durationMs) { 230 constructor(elementId, durationMs) {
248 this.meshId = elementId; 231 this.meshId = elementId;
249 this.to = {}; 232 this.to = {};
250 this.easing = {}; 233 this.easing = {};
251 this.easing.type = api.Easing.LINEAR; 234 this.easing.type = api.Easing.LINEAR;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 Mode: Mode, 292 Mode: Mode,
310 getContentElementId: getContentElementId, 293 getContentElementId: getContentElementId,
311 UiElement: UiElement, 294 UiElement: UiElement,
312 UiElementUpdate: UiElementUpdate, 295 UiElementUpdate: UiElementUpdate,
313 Animation: Animation, 296 Animation: Animation,
314 doAction: doAction, 297 doAction: doAction,
315 domLoaded: domLoaded, 298 domLoaded: domLoaded,
316 setUiCssSize: setUiCssSize, 299 setUiCssSize: setUiCssSize,
317 }; 300 };
318 })(); 301 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698