11<template >
2- <BlockUI ref =" blockUi"
3- class =" opencor overflow-hidden h-full"
4- :class =" showMainMenu ? 'with-main-menu' : ''"
2+ <BlockUI ref =" blockUi" class =" opencor overflow-hidden h-full" :class =" showMainMenu ? 'with-main-menu' : ''"
53 :blocked =" compBlockUiEnabled"
64 @click =" activateInstance"
75 @focus =" activateInstance"
@@ -140,8 +138,8 @@ const props = defineProps<IOpenCORProps>();
140138const { isDialogActive } = provideDialogState ();
141139
142140const blockUi = vue .ref <vue .ComponentPublicInstance | null >(null );
143- const mainMenu = vue .ref <vue .ComponentPublicInstance | null >(null );
144141const toastId = vue .ref (' opencorToast' );
142+ const mainMenu = vue .ref <vue .ComponentPublicInstance | null >(null );
145143const mainMenuId = vue .ref (' opencorMainMenu' );
146144const files = vue .ref <HTMLElement | null >(null );
147145const contents = vue .ref <InstanceType <typeof IContentsComponent > | null >(null );
@@ -162,10 +160,6 @@ const compIsActive = vue.computed(() => {
162160 return activeInstanceUid .value === crtInstanceUid ;
163161});
164162
165- const showMainMenu = vue .computed (() => {
166- return ! electronApi && ! props .omex ;
167- });
168-
169163// Determine whether the component UI should be blocked/enabled.
170164// Note: compBlockUiEnabled is used to determine whether PrimeVue's BlockUI component should be enabled, whereas
171165// compUiEnabled is used to determine whether the UI should be enabled (it checks whether various dialogs are
@@ -188,6 +182,12 @@ const compUiEnabled = vue.computed(() => {
188182 return ! compBlockUiEnabled .value && ! isDialogActive .value ;
189183});
190184
185+ // Determine whether to show the main menu or not.
186+
187+ const showMainMenu = vue .computed (() => {
188+ return ! electronApi && ! props .omex ;
189+ });
190+
191191// Provide access to our progress message features.
192192
193193export interface IProgressMessage {
@@ -940,9 +940,9 @@ vue.onMounted(() => {
940940 }, SHORT_DELAY );
941941});
942942
943- // Dynamically track the main menu height .
943+ // Track the height of our main menu.
944944
945- let stopHeightTracking : (() => void ) | null = null ;
945+ let stopTrackingMainMenuHeight : (() => void ) | null = null ;
946946
947947vue .onMounted (() => {
948948 if (! showMainMenu .value ) {
@@ -954,15 +954,16 @@ vue.onMounted(() => {
954954 const blockUiElement = blockUi .value ?.$el as HTMLElement | undefined ;
955955
956956 if (mainMenuElement && blockUiElement ) {
957- stopHeightTracking = vueCommon .setupElementHeightTracking (mainMenuElement , blockUiElement , ' --main-menu-height' );
957+ stopTrackingMainMenuHeight = vueCommon .trackElementHeight (mainMenuElement , blockUiElement , ' --main-menu-height' );
958958 }
959959 });
960960});
961961
962962vue .onBeforeUnmount (() => {
963- if (stopHeightTracking ) {
964- stopHeightTracking ();
965- stopHeightTracking = null ;
963+ if (stopTrackingMainMenuHeight ) {
964+ stopTrackingMainMenuHeight ();
965+
966+ stopTrackingMainMenuHeight = null ;
966967 }
967968});
968969
@@ -1262,15 +1263,6 @@ const onGitHubButtonClick = async (): Promise<void> => {
12621263 color : var (--p-red-700 );
12631264}
12641265
1265- .with-main-menu {
1266- :deep(.p-dialog-mask) {
1267- padding-top : var (--main-menu-height , 28px ) !important ;
1268- }
1269- :deep(.p-message ) {
1270- margin-top : calc (var (--main-menu-height , 28px ) / 2 ) !important ;
1271- }
1272- }
1273-
12741266@media (prefers-color-scheme: dark) {
12751267 .connected-to-github ,
12761268 :deep(.connected-to-github .pi-github ) {
@@ -1300,4 +1292,14 @@ const onGitHubButtonClick = async (): Promise<void> => {
13001292 color : var (--p-red-200 );
13011293 }
13021294}
1295+
1296+ .with-main-menu {
1297+ :deep(.p-dialog-mask) {
1298+ padding-top : var (--main-menu-height ) !important ;
1299+ }
1300+
1301+ :deep(.p-message ) {
1302+ margin-top : calc (0.5 * var (--main-menu-height )) !important ;
1303+ }
1304+ }
13031305 </style >
0 commit comments