Don't show proxy if tablet has been opened by other means

This commit is contained in:
David Rowe 2018-08-10 13:10:24 +12:00
parent b240a4248d
commit 557f18f370

View file

@ -107,8 +107,10 @@
// #region State Machine =================================================================================================== // #region State Machine ===================================================================================================
function enterProxyHidden() { function enterProxyHidden() {
Overlays.deleteOverlay(proxyOverlay); if (proxyOverlay) {
proxyOverlay = null; Overlays.deleteOverlay(proxyOverlay);
proxyOverlay = null;
}
} }
function enterProxyVisible(hand) { function enterProxyVisible(hand) {
@ -253,30 +255,39 @@
// Assumes that is HMD.mounted. // Assumes that is HMD.mounted.
switch (rezzerState) { switch (rezzerState) {
case PROXY_HIDDEN: case PROXY_HIDDEN:
// Don't show proxy is tablet is already displayed.
if (HMD.showTablet) {
break;
}
// Compare palm directions of hands with vectors from palms to camera. // Compare palm directions of hands with vectors from palms to camera.
if (shouldShowProxy(LEFT_HAND)) { if (shouldShowProxy(LEFT_HAND)) {
setState(PROXY_VISIBLE, LEFT_HAND); setState(PROXY_VISIBLE, LEFT_HAND);
break;
} else if (shouldShowProxy(RIGHT_HAND)) { } else if (shouldShowProxy(RIGHT_HAND)) {
setState(PROXY_VISIBLE, RIGHT_HAND); setState(PROXY_VISIBLE, RIGHT_HAND);
break;
} }
break; break;
case PROXY_VISIBLE: case PROXY_VISIBLE:
// Hide proxy if tablet has been displayed by other means.
if (HMD.showTablet) {
setState(PROXY_HIDDEN);
break;
}
// Check that palm direction of proxy hand still less than maximum angle. // Check that palm direction of proxy hand still less than maximum angle.
if (!shouldShowProxy(proxyHand)) { if (!shouldShowProxy(proxyHand)) {
setState(PROXY_HIDDEN); setState(PROXY_HIDDEN);
break;
} }
break; break;
case PROXY_GRABBED: case PROXY_GRABBED:
case PROXY_EXPANDING: case PROXY_EXPANDING:
break; // Hide proxy if tablet has been displayed by other means.
case TABLET_OPEN: if (HMD.showTablet) {
if (!HMD.showTablet) {
setState(PROXY_HIDDEN); setState(PROXY_HIDDEN);
} }
break; break;
case TABLET_OPEN:
// Immediately transition back to PROXY_HIDDEN.
setState(PROXY_HIDDEN);
break;
default: default:
error("Missing case: " + rezzerState); error("Missing case: " + rezzerState);
} }