mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
remove vr overlay dom when overlay disabled
This commit is contained in:
+24
-1
@@ -100,6 +100,26 @@ export const useVrStore = defineStore('Vr', () => {
|
|||||||
if (appearanceSettingsStore.isDarkMode) {
|
if (appearanceSettingsStore.isDarkMode) {
|
||||||
notificationTheme = 'sunset';
|
notificationTheme = 'sunset';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} VrConfigVarsPayload
|
||||||
|
* @property {boolean} overlayNotifications
|
||||||
|
* @property {boolean} hideDevicesFromFeed
|
||||||
|
* @property {boolean} vrOverlayCpuUsage
|
||||||
|
* @property {boolean} minimalFeed
|
||||||
|
* @property {string} notificationPosition
|
||||||
|
* @property {number} notificationTimeout
|
||||||
|
* @property {number} photonOverlayMessageTimeout
|
||||||
|
* @property {string} notificationTheme
|
||||||
|
* @property {boolean} backgroundEnabled
|
||||||
|
* @property {boolean} dtHour12
|
||||||
|
* @property {boolean} pcUptimeOnFeed
|
||||||
|
* @property {string} appLanguage
|
||||||
|
* @property {number} notificationOpacity
|
||||||
|
* @property {boolean} isWristDisabled
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {VrConfigVarsPayload} */
|
||||||
const VRConfigVars = {
|
const VRConfigVars = {
|
||||||
overlayNotifications:
|
overlayNotifications:
|
||||||
notificationsSettingsStore.overlayNotifications,
|
notificationsSettingsStore.overlayNotifications,
|
||||||
@@ -116,8 +136,11 @@ export const useVrStore = defineStore('Vr', () => {
|
|||||||
dtHour12: appearanceSettingsStore.dtHour12,
|
dtHour12: appearanceSettingsStore.dtHour12,
|
||||||
pcUptimeOnFeed: wristOverlaySettingsStore.pcUptimeOnFeed,
|
pcUptimeOnFeed: wristOverlaySettingsStore.pcUptimeOnFeed,
|
||||||
appLanguage: appearanceSettingsStore.appLanguage,
|
appLanguage: appearanceSettingsStore.appLanguage,
|
||||||
notificationOpacity: advancedSettingsStore.notificationOpacity
|
notificationOpacity: advancedSettingsStore.notificationOpacity,
|
||||||
|
isWristDisabled: wristOverlaySettingsStore.overlayWrist === false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
const json = JSON.stringify(VRConfigVars);
|
const json = JSON.stringify(VRConfigVars);
|
||||||
AppApi.ExecuteVrFeedFunction('configUpdate', json);
|
AppApi.ExecuteVrFeedFunction('configUpdate', json);
|
||||||
AppApi.ExecuteVrOverlayFunction('configUpdate', json);
|
AppApi.ExecuteVrOverlayFunction('configUpdate', json);
|
||||||
|
|||||||
+93
-8
@@ -3,7 +3,7 @@
|
|||||||
id="x-app"
|
id="x-app"
|
||||||
class="x-app x-app-type"
|
class="x-app x-app-type"
|
||||||
:class="{ background: appType === 'wrist' && config && config.backgroundEnabled }">
|
:class="{ background: appType === 'wrist' && config && config.backgroundEnabled }">
|
||||||
<template v-if="appType === 'wrist'">
|
<template v-if="appType === 'wrist' && !vrState.isWristDisabled">
|
||||||
<div class="x-container" style="flex: 1">
|
<div class="x-container" style="flex: 1">
|
||||||
<div class="x-friend-list" ref="list" style="color: #aaa">
|
<div class="x-friend-list" ref="list" style="color: #aaa">
|
||||||
<template v-if="config && config.minimalFeed">
|
<template v-if="config && config.minimalFeed">
|
||||||
@@ -1281,7 +1281,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- HMD Overlay -->
|
<!-- HMD Overlay -->
|
||||||
<template v-else>
|
<template v-else-if="appType === 'hmd' && !vrState.isHmdDisabled">
|
||||||
<svg class="np-progress-circle">
|
<svg class="np-progress-circle">
|
||||||
<circle
|
<circle
|
||||||
class="np-progress-circle-stroke"
|
class="np-progress-circle-stroke"
|
||||||
@@ -1407,7 +1407,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { nextTick, onMounted, reactive, toRefs } from 'vue';
|
import { nextTick, onBeforeUnmount, onMounted, reactive, toRefs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import MarqueeText from 'vue-marquee-text-component';
|
import MarqueeText from 'vue-marquee-text-component';
|
||||||
@@ -1472,9 +1472,16 @@
|
|||||||
notificationOpacity: 100,
|
notificationOpacity: 100,
|
||||||
hudFeed: [],
|
hudFeed: [],
|
||||||
hudTimeout: [],
|
hudTimeout: [],
|
||||||
cleanHudFeedLoopStatus: false
|
cleanHudFeedLoopStatus: false,
|
||||||
|
isHmdDisabled: false,
|
||||||
|
isWristDisabled: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let isUnmounted = false;
|
||||||
|
let updateStatsLoopTimeoutId = null;
|
||||||
|
let updateVrElectronLoopTimeoutId = null;
|
||||||
|
let cleanHudFeedLoopTimeoutId = null;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.$vr = {};
|
window.$vr = {};
|
||||||
window.$vr.configUpdate = configUpdate;
|
window.$vr.configUpdate = configUpdate;
|
||||||
@@ -1514,8 +1521,71 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
isUnmounted = true;
|
||||||
|
|
||||||
|
if (updateStatsLoopTimeoutId !== null) {
|
||||||
|
workerTimers.clearTimeout(updateStatsLoopTimeoutId);
|
||||||
|
updateStatsLoopTimeoutId = null;
|
||||||
|
}
|
||||||
|
if (updateVrElectronLoopTimeoutId !== null) {
|
||||||
|
workerTimers.clearTimeout(updateVrElectronLoopTimeoutId);
|
||||||
|
updateVrElectronLoopTimeoutId = null;
|
||||||
|
}
|
||||||
|
if (cleanHudFeedLoopTimeoutId !== null) {
|
||||||
|
workerTimers.clearTimeout(cleanHudFeedLoopTimeoutId);
|
||||||
|
cleanHudFeedLoopTimeoutId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Noty.closeAll();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error closing Noty notifications:', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window.$vr === 'object' && window.$vr) {
|
||||||
|
for (const key of Object.keys(window.$vr)) {
|
||||||
|
delete window.$vr[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
delete window.$vr;
|
||||||
|
} catch {
|
||||||
|
window.$vr = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VR overlay config payload (passed as JSON string).
|
||||||
|
* @typedef {Object} VrConfigVarsPayload
|
||||||
|
* @property {boolean} overlayNotifications
|
||||||
|
* @property {boolean} hideDevicesFromFeed
|
||||||
|
* @property {boolean} vrOverlayCpuUsage
|
||||||
|
* @property {boolean} minimalFeed
|
||||||
|
* @property {string} notificationPosition
|
||||||
|
* @property {number} notificationTimeout
|
||||||
|
* @property {number} photonOverlayMessageTimeout
|
||||||
|
* @property {string} notificationTheme
|
||||||
|
* @property {boolean} backgroundEnabled
|
||||||
|
* @property {boolean} dtHour12
|
||||||
|
* @property {boolean} pcUptimeOnFeed
|
||||||
|
* @property {string} appLanguage
|
||||||
|
* @property {number} notificationOpacity
|
||||||
|
* @property {boolean} isWristDisabled
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} json
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
function configUpdate(json) {
|
function configUpdate(json) {
|
||||||
vrState.config = JSON.parse(json);
|
vrState.config = JSON.parse(json);
|
||||||
|
if (vrState.config.isWristDisabled) {
|
||||||
|
vrState.isWristDisabled = true;
|
||||||
|
}
|
||||||
|
if (!vrState.config.overlayNotifications) {
|
||||||
|
vrState.isHmdDisabled = false;
|
||||||
|
}
|
||||||
vrState.hudFeed = [];
|
vrState.hudFeed = [];
|
||||||
vrState.hudTimeout = [];
|
vrState.hudTimeout = [];
|
||||||
setDatetimeFormat();
|
setDatetimeFormat();
|
||||||
@@ -1542,7 +1612,13 @@
|
|||||||
function nowPlayingUpdate(json) {
|
function nowPlayingUpdate(json) {
|
||||||
vrState.nowPlaying = JSON.parse(json);
|
vrState.nowPlaying = JSON.parse(json);
|
||||||
if (vrState.appType === 'hmd') {
|
if (vrState.appType === 'hmd') {
|
||||||
const circle = /** @type {SVGCircleElement} */ (document.querySelector('.np-progress-circle-stroke'));
|
const circle = /** @type {SVGCircleElement | null} */ (
|
||||||
|
document.querySelector('.np-progress-circle-stroke')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!circle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (vrState.lastLocation.progressPie && vrState.nowPlaying.percentage !== 0) {
|
if (vrState.lastLocation.progressPie && vrState.nowPlaying.percentage !== 0) {
|
||||||
circle.style.opacity = (0.5).toString();
|
circle.style.opacity = (0.5).toString();
|
||||||
@@ -1700,7 +1776,10 @@
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
workerTimers.setTimeout(() => updateStatsLoop(), 500);
|
if (isUnmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateStatsLoopTimeoutId = workerTimers.setTimeout(() => updateStatsLoop(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateVrElectronLoop() {
|
async function updateVrElectronLoop() {
|
||||||
@@ -1739,7 +1818,10 @@
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
workerTimers.setTimeout(() => updateVrElectronLoop(), 500);
|
if (isUnmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateVrElectronLoopTimeoutId = workerTimers.setTimeout(() => updateVrElectronLoop(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function playNoty(json) {
|
function playNoty(json) {
|
||||||
@@ -1941,7 +2023,10 @@
|
|||||||
vrState.cleanHudFeedLoopStatus = false;
|
vrState.cleanHudFeedLoopStatus = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
workerTimers.setTimeout(() => cleanHudFeedLoop(), 500);
|
if (isUnmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cleanHudFeedLoopTimeoutId = workerTimers.setTimeout(() => cleanHudFeedLoop(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanHudFeed() {
|
function cleanHudFeed() {
|
||||||
|
|||||||
Reference in New Issue
Block a user