CSUI: set opacity to 0 when extension menu is not triggered

This commit is contained in:
Tamius Han 2025-01-12 23:24:01 +01:00
parent d433878680
commit 42ac51f1e9
2 changed files with 13 additions and 1 deletions

View File

@ -112,9 +112,16 @@ export default {
if (! this.uwWindowVisible) { if (! this.uwWindowVisible) {
this.uwTriggerZoneVisible = true; this.uwTriggerZoneVisible = true;
clearTimeout(this.uwTriggerZoneTimeout); clearTimeout(this.uwTriggerZoneTimeout);
const windowParent = window.parent;
this.uwTriggerZoneTimeout = setTimeout( this.uwTriggerZoneTimeout = setTimeout(
() => { () => {
this.uwTriggerZoneVisible = false; this.uwTriggerZoneVisible = false;
windowParent.postMessage(
{action: 'uwui-hidden', opacity: false},
origin
);
}, },
500 500
); );
@ -134,6 +141,7 @@ export default {
{ {
action: 'uwui-clickable', action: 'uwui-clickable',
clickable: isClickable, clickable: isClickable,
opacity: isClickable || this.contextMenuActive || this.uwTriggerZoneVisible,
hoverStats: { hoverStats: {
isOverTriggerZone: isOverTriggerZone, isOverTriggerZone: isOverTriggerZone,
isOverMenuTrigger: isOverMenuTrigger, isOverMenuTrigger: isOverMenuTrigger,

View File

@ -95,6 +95,7 @@ class UI {
iframe.style.zIndex = this.isGlobal ? '90009' : '90000'; iframe.style.zIndex = this.isGlobal ? '90009' : '90000';
iframe.style.border = 0; iframe.style.border = 0;
iframe.style.pointerEvents = 'none'; iframe.style.pointerEvents = 'none';
iframe.style.opacity = 0;
iframe.style.backgroundColor = 'transparent !important'; iframe.style.backgroundColor = 'transparent !important';
/* so we have a problem: we want iframe to be clickthrough everywhere except /* so we have a problem: we want iframe to be clickthrough everywhere except
@ -323,7 +324,7 @@ class UI {
} }
this.uiIframe.style.pointerEvents = event.data.clickable ? 'auto' : 'none'; this.uiIframe.style.pointerEvents = event.data.clickable ? 'auto' : 'none';
this.uiIframe.style.display = event.data.opacity ? '100' : '0'; this.uiIframe.style.opacity = event.data.opacity ? '100' : '0';
break; break;
case 'uw-bus-tunnel': case 'uw-bus-tunnel':
const busCommand = event.data.payload; const busCommand = event.data.payload;
@ -335,6 +336,9 @@ class UI {
case 'uwui-interface-ready': case 'uwui-interface-ready':
this.setUiVisibility(!this.isGlobal); this.setUiVisibility(!this.isGlobal);
break; break;
case 'uwui-hidden':
this.uiIframe.style.opacity = event.data.opacity ? '100' : '0';
break;
case 'uwui-global-window-hidden': case 'uwui-global-window-hidden':
if (!this.isGlobal) { if (!this.isGlobal) {
return; // This shouldn't even happen in non-global windows return; // This shouldn't even happen in non-global windows