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

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

Issue 2740013003: Exiting menu mode when content preview is clicked (Closed)
Patch Set: Resolving conflict Created 3 years, 9 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.html ('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.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js
index aa5dde64e36ea99a2a5d4660a09b0e331f2e2186..098f5b8ee9a117abfd6173c18376b876cfbaa731 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -39,6 +39,8 @@ var vrShellUi = (function() {
/** @const */ this.MENU_MODE_SCREEN_HEIGHT = 0.8;
/** @const */ this.MENU_MODE_SCREEN_ELEVATION = 0.2;
/** @const */ this.BACKGROUND_DISTANCE_MULTIPLIER = 1.414;
+ /** @const */ this.DOM_INTERCEPTOR_SELECTOR = '#content-interceptor';
+ /** @const */ this.DOM_INTERCEPTOR_ELEVATION = 0.01;
this.menuMode = false;
this.fullscreen = false;
@@ -61,6 +63,24 @@ var vrShellUi = (function() {
backPlane.setFill(new api.NoFill());
ui.addElement(backPlane);
+ // Place invisible plane on top of content quad, to intercept the clicks
+ // while on menu mode.
+ this.interceptor = new DomUiElement(this.DOM_INTERCEPTOR_SELECTOR);
+ let update = new api.UiElementUpdate();
+ update.setTranslation(0, 0, this.DOM_INTERCEPTOR_ELEVATION);
+ update.setVisible(false);
+ update.setParentId(this.elementId);
+ update.setSize(
+ this.MENU_MODE_SCREEN_HEIGHT * this.SCREEN_RATIO,
+ this.MENU_MODE_SCREEN_HEIGHT);
+ ui.updateElement(this.interceptor.id, update);
+ let interceptorButton =
+ document.querySelector(this.DOM_INTERCEPTOR_SELECTOR);
+ interceptorButton.addEventListener('click', function() {
+ uiManager.exitMenuMode();
+ ui.flush();
+ });
+
this.updateState();
}
@@ -106,6 +126,10 @@ var vrShellUi = (function() {
distance = this.FULLSCREEN_DISTANCE;
}
+ let update = new api.UiElementUpdate();
+ update.setVisible(this.menuMode);
+ ui.updateElement(this.interceptor.id, update);
+
let anim;
anim = new api.Animation(this.elementId, ANIM_DURATION);
anim.setTranslation(0, y, -distance);
@@ -999,6 +1023,13 @@ var vrShellUi = (function() {
this.controls.setForwardButtonEnabled(this.canGoForward);
}
+ exitMenuMode() {
+ if (this.menuMode) {
+ this.menuMode = false;
+ this.updateState();
+ }
+ }
+
updateState() {
/** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000;
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698