mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 13:34:01 +02:00
Merge pull request #14225 from wayne-chen/interstitialHideProgressJS-RC75
hide progress overlays if interstitial mode
This commit is contained in:
commit
1ff69844f2
7 changed files with 45 additions and 7 deletions
|
@ -3534,6 +3534,7 @@ void Application::setIsInterstitialMode(bool interstitialMode) {
|
|||
if (enableInterstitial) {
|
||||
if (_interstitialMode != interstitialMode) {
|
||||
_interstitialMode = interstitialMode;
|
||||
emit interstitialModeChanged(_interstitialMode);
|
||||
|
||||
DependencyManager::get<AudioClient>()->setAudioPaused(_interstitialMode);
|
||||
DependencyManager::get<AvatarManager>()->setMyAvatarDataPacketsPaused(_interstitialMode);
|
||||
|
|
|
@ -335,6 +335,8 @@ signals:
|
|||
|
||||
void uploadRequest(QString path);
|
||||
|
||||
void interstitialModeChanged(bool isInInterstitialMode);
|
||||
|
||||
void loginDialogPoppedUp();
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -54,6 +54,9 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
|||
});
|
||||
|
||||
connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::onWindowGeometryChanged);
|
||||
connect(qApp, &Application::interstitialModeChanged, [this] (bool interstitialMode) {
|
||||
emit interstitialModeChanged(interstitialMode);
|
||||
});
|
||||
}
|
||||
|
||||
WindowScriptingInterface::~WindowScriptingInterface() {
|
||||
|
|
|
@ -619,6 +619,14 @@ signals:
|
|||
*/
|
||||
void redirectErrorStateChanged(bool isInErrorState);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when interstitial mode changes.
|
||||
* @function Window.interstitialModeChanged
|
||||
* @param {bool} interstitialMode - The mode of the interstitial is changed to.
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void interstitialModeChanged(bool interstitialMode);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with
|
||||
* <code>includeAnimated = false</code> or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}.
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
(function() {
|
||||
Script.include("/~/system/libraries/Xform.js");
|
||||
Script.include("/~/system/libraries/globals.js");
|
||||
var DEBUG = false;
|
||||
var MIN_LOADING_PROGRESS = 3.6;
|
||||
var TOTAL_LOADING_PROGRESS = 3.8;
|
||||
|
@ -379,6 +380,12 @@
|
|||
var currentProgress = 0.1;
|
||||
|
||||
function updateOverlays(physicsEnabled) {
|
||||
|
||||
if (isInterstitialOverlaysVisible !== !physicsEnabled && !physicsEnabled === true) {
|
||||
// visible changed to true.
|
||||
isInterstitialOverlaysVisible = !physicsEnabled;
|
||||
}
|
||||
|
||||
var properties = {
|
||||
visible: !physicsEnabled
|
||||
};
|
||||
|
@ -425,6 +432,11 @@
|
|||
if (physicsEnabled) {
|
||||
Camera.mode = previousCameraMode;
|
||||
}
|
||||
|
||||
if (isInterstitialOverlaysVisible !== !physicsEnabled && !physicsEnabled === false) {
|
||||
// visible changed to false.
|
||||
isInterstitialOverlaysVisible = !physicsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
function scaleInterstitialPage(sensorToWorldScale) {
|
||||
|
|
|
@ -9,3 +9,5 @@
|
|||
//
|
||||
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
isInterstitialOverlaysVisible = false;
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
//
|
||||
|
||||
(function () { // BEGIN LOCAL_SCOPE
|
||||
|
||||
function debug() {
|
||||
//print.apply(null, arguments);
|
||||
}
|
||||
|
||||
Script.include("/~/system/libraries/globals.js");
|
||||
var rawProgress = 100, // % raw value.
|
||||
displayProgress = 100, // % smoothed value to display.
|
||||
alpha = 0.0,
|
||||
|
@ -83,7 +83,9 @@
|
|||
// The initial delay cooldown keeps us from tracking progress before the allotted time
|
||||
// has passed.
|
||||
INITIAL_DELAY_COOLDOWN_TIME = 1000,
|
||||
initialDelayCooldown = 0;
|
||||
initialDelayCooldown = 0,
|
||||
|
||||
isInInterstitialMode = false;
|
||||
|
||||
function fade() {
|
||||
|
||||
|
@ -265,7 +267,7 @@
|
|||
|
||||
// Update state
|
||||
if (!visible) { // Not visible because no recent downloads
|
||||
if (displayProgress < 100 || gpuTextures > 0) { // Have started downloading so fade in
|
||||
if ((displayProgress < 100 || gpuTextures > 0) && !isInInterstitialMode && !isInterstitialOverlaysVisible) { // Have started downloading so fade in
|
||||
visible = true;
|
||||
alphaDelta = ALPHA_DELTA_IN;
|
||||
fadeTimer = Script.setInterval(fade, FADE_INTERVAL);
|
||||
|
@ -305,10 +307,13 @@
|
|||
} else {
|
||||
x = x * BAR_HMD_REPEAT;
|
||||
}
|
||||
if (isInInterstitialMode || isInterstitialOverlaysVisible) {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
// Update progress bar
|
||||
Overlays.editOverlay(barDesktop.overlay, {
|
||||
visible: !isHMD,
|
||||
visible: !isHMD && visible,
|
||||
bounds: {
|
||||
x: barDesktop.repeat - x,
|
||||
y: windowHeight - barDesktop.height,
|
||||
|
@ -318,7 +323,7 @@
|
|||
});
|
||||
|
||||
Overlays.editOverlay(barHMD.overlay, {
|
||||
visible: isHMD,
|
||||
visible: isHMD && visible,
|
||||
bounds: {
|
||||
x: BAR_HMD_REPEAT - x,
|
||||
y: windowHeight - BAR_HMD_HEIGHT,
|
||||
|
@ -328,11 +333,11 @@
|
|||
});
|
||||
|
||||
Overlays.editOverlay(textDesktop.overlay, {
|
||||
visible: !isHMD
|
||||
visible: !isHMD && visible
|
||||
});
|
||||
|
||||
Overlays.editOverlay(textHMD.overlay, {
|
||||
visible: isHMD
|
||||
visible: isHMD && visible
|
||||
});
|
||||
|
||||
// Update 2D overlays to maintain positions at bottom middle of window
|
||||
|
@ -344,6 +349,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function interstitialModeChanged(inMode) {
|
||||
isInInterstitialMode = inMode;
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
var is4k = Window.innerWidth > 3000;
|
||||
|
||||
|
@ -369,6 +378,7 @@
|
|||
}
|
||||
|
||||
setUp();
|
||||
Window.interstitialModeChanged.connect(interstitialModeChanged);
|
||||
GlobalServices.downloadInfoChanged.connect(onDownloadInfoChanged);
|
||||
GlobalServices.updateDownloadInfo();
|
||||
Script.setInterval(update, 1000 / 60);
|
||||
|
|
Loading…
Reference in a new issue