diff --git a/packages/ui/src/components/Popup.svelte b/packages/ui/src/components/Popup.svelte index 5f3d8bf0cb..fe8d5eb529 100644 --- a/packages/ui/src/components/Popup.svelte +++ b/packages/ui/src/components/Popup.svelte @@ -19,6 +19,7 @@ import PopupInstance from './PopupInstance.svelte' export let contentPanel: HTMLElement | undefined = undefined + export let fullScreen: boolean = false const instances: PopupInstance[] = [] @@ -26,13 +27,21 @@ instances.forEach((p) => p.fitPopupInstance()) } - $: instances.length = $popups.filter((p) => p.dock !== true).length + const shouldDisplayPopup = (popup: any): boolean => { + return ( + (fullScreen && document.fullscreenElement != null && popup.element !== 'full-centered') || + (!fullScreen && document.fullscreenElement != null && popup.element === 'full-centered') || + (!fullScreen && document.fullscreenElement == null) + ) + } + + $: instances.length = $popups.filter((p) => p.dock !== true && shouldDisplayPopup(p)).length {#if $popups.length > 0} {/if} -{#each $popups.filter((p) => p.dock !== true) as popup, i (popup.id)} +{#each $popups.filter((p) => p.dock !== true && shouldDisplayPopup(p)) as popup, i (popup.id)} + (fullScreen && document.fullscreenElement == null) || (!fullScreen && document.fullscreenElement != null) const clearStyles = (): void => { shown = false @@ -248,6 +252,7 @@ } const hideTooltip = (): void => { + if (shouldHideTooltip()) return if (tooltipHTML) options.visibility = 'hidden' shown = false closeTooltip() @@ -256,7 +261,7 @@ $: shownTooltip = $tooltip.element && tooltipHTML const whileShow = (ev: MouseEvent): void => { - if (!$tooltip.element) return + if (!$tooltip.element || shouldHideTooltip()) return const rectP = tooltipHTML.getBoundingClientRect() rect = $tooltip.element.getBoundingClientRect() const dT: number = dir === 'bottom' && $tooltip.kind !== 'submenu' ? 12 : 0 @@ -270,12 +275,13 @@ } } - $: if (kind === 'submenu') { + $: if (kind === 'submenu' && !shouldHideTooltip()) { options = fitSubmenu() - } else { + } else if (!shouldHideTooltip()) { options = fitTooltip(tooltipHTML, clWidth) } afterUpdate(() => { + if (shouldHideTooltip()) return if (kind === 'submenu') { options = fitSubmenu() } else { @@ -287,18 +293,6 @@ }) -{#if $tooltip.kind === 'popup'} - -