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

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui_api.js

Issue 2624243002: VrShell: Allow native control of UI element opacity. (Closed)
Patch Set: for (auto nit : nits) nit.fix(); Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/vr_shell/vr_shell_ui_api.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
index 967de17057397527263f8bf84fcb66a9f83aa3fa..bc1709cd4bd3ff9a34600aa25d5b4e42db934e23 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
@@ -24,7 +24,9 @@ api.Command = {
* @param {Array<Object>} commands
*/
api.sendCommands = function(commands) {
- chrome.send('updateScene', commands);
+ if (commands.length > 0) {
+ chrome.send('updateScene', commands);
+ }
};
/**
@@ -214,12 +216,21 @@ api.UiElementUpdate = class {
/**
* Causes an element to be rendered relative to the field of view, rather
- * than the scene. Elements locked in this way should not have a parent.
+ * than the scene. Elements locked in this way should not have a parent.
* @param {boolean} locked
*/
setLockToFieldOfView(locked) {
this.properties['lockToFov'] = !!locked;
}
+
+ /**
+ * Causes an element to be rendered with a specified opacity, between 0.0 and
+ * 1.0. Opacity is inherited by children.
+ * @param {number} opacity
+ */
+ setOpacity(opacity) {
+ this.properties['opacity'] = opacity;
+ }
};
/**
@@ -257,7 +268,8 @@ api.Property = {
'SIZE': 1,
'TRANSLATION': 2,
'SCALE': 3,
- 'ROTATION': 4
+ 'ROTATION': 4,
+ 'OPACITY': 5
};
/**
@@ -359,4 +371,13 @@ api.Animation = class {
this.to.y = y;
this.to.z = z;
}
+
+ /**
+ * Set the animation's final element opacity.
+ * @param {number} opacity
+ */
+ setOpacity(opacity) {
+ this.property = api.Property.OPACITY;
+ this.to.x = opacity;
+ }
};
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698