diff --git a/src/assets/defaults.ts b/src/assets/defaults.ts index aa2f8bff8..54583aa29 100644 --- a/src/assets/defaults.ts +++ b/src/assets/defaults.ts @@ -13,7 +13,7 @@ export const defaultProfileVehicleCorrespondency = { } export const defaultWidgetManagerVars = { - timesMounted: 0, + everMounted: false, configMenuOpen: false, allowMoving: false, lastNonMaximizedX: 0.4, @@ -24,7 +24,7 @@ export const defaultWidgetManagerVars = { } export const defaultMiniWidgetManagerVars = { - timesMounted: 0, + everMounted: false, configMenuOpen: false, highlighted: false, } diff --git a/src/components/WidgetHugger.vue b/src/components/WidgetHugger.vue index b75c1ae00..4ed4f7cff 100644 --- a/src/components/WidgetHugger.vue +++ b/src/components/WidgetHugger.vue @@ -211,10 +211,10 @@ const resizeWidgetToMinimalSize = (): void => { } onMounted(async () => { - if (managerVars.value.timesMounted === 0) { + if (managerVars.value.everMounted === false) { resizeWidgetToMinimalSize() } - managerVars.value.timesMounted += 1 + managerVars.value.everMounted = true if (widgetResizeHandles.value) { for (let i = 0; i < widgetResizeHandles.value.length; i++) { diff --git a/src/stores/widgetManager.ts b/src/stores/widgetManager.ts index e7f2d5691..0acafea53 100644 --- a/src/stores/widgetManager.ts +++ b/src/stores/widgetManager.ts @@ -593,9 +593,29 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => { v.visible = v.visible ?? true // If there's any configuration menu open, close it - v.widgets.forEach((w) => (w.managerVars.configMenuOpen = false)) - v.miniWidgetContainers.forEach((c) => c.widgets.forEach((w) => (w.managerVars.configMenuOpen = false))) + v.widgets.forEach((w) => { + w.managerVars.configMenuOpen = false + w.managerVars.everMounted = true + // @ts-ignore: This is an old value that we are removing on those that still hold it + w.managerVars.timesMounted = undefined + }) + v.miniWidgetContainers.forEach((c) => + c.widgets.forEach((w) => { + w.managerVars.configMenuOpen = false + w.managerVars.everMounted = true + // @ts-ignore: This is an old value that we are removing on those that still hold it + w.managerVars.timesMounted = undefined + }) + ) }) + + currentMiniWidgetsProfile.value.containers.forEach((c) => + c.widgets.forEach((w) => { + w.managerVars.everMounted = true + // @ts-ignore: This is an old value that we are removing on those that still hold it + w.managerVars.timesMounted = undefined + }) + ) }) }) diff --git a/src/types/miniWidgets.ts b/src/types/miniWidgets.ts index cad5039c7..3f7ac8a84 100644 --- a/src/types/miniWidgets.ts +++ b/src/types/miniWidgets.ts @@ -42,7 +42,7 @@ export type MiniWidget = { /** * Number of times the mini-widget was mounted */ - timesMounted: number + everMounted: boolean /** * If the configuration menu is open or not */ diff --git a/src/types/widgets.ts b/src/types/widgets.ts index 3331b8b7e..372e3986d 100644 --- a/src/types/widgets.ts +++ b/src/types/widgets.ts @@ -51,7 +51,7 @@ export type Widget = { /** * Number of times the widget was mounted */ - timesMounted: number + everMounted: boolean /** * If the configuration menu is open or not */ @@ -128,7 +128,7 @@ export type Profile = { export const isWidget = (maybeWidget: Widget): maybeWidget is Widget => { const widgetProps = ['hash', 'component', 'position', 'size', 'name', 'options', 'managerVars'] - const managetVarsProps = ['timesMounted'] + const managetVarsProps = ['everMounted'] let realWidget = true widgetProps.forEach((p) => { // @ts-ignore