From 42ac51f1e93dd8698fa0ea8ddc2f3d47ee193531 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 12 Jan 2025 23:24:01 +0100 Subject: [PATCH] CSUI: set opacity to 0 when extension menu is not triggered --- src/csui/src/utils/UIProbeMixin.js | 8 ++++++++ src/ext/lib/uwui/UI.js | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/csui/src/utils/UIProbeMixin.js b/src/csui/src/utils/UIProbeMixin.js index 35b8653..f13ee4e 100644 --- a/src/csui/src/utils/UIProbeMixin.js +++ b/src/csui/src/utils/UIProbeMixin.js @@ -112,9 +112,16 @@ export default { if (! this.uwWindowVisible) { this.uwTriggerZoneVisible = true; clearTimeout(this.uwTriggerZoneTimeout); + + const windowParent = window.parent; this.uwTriggerZoneTimeout = setTimeout( () => { this.uwTriggerZoneVisible = false; + + windowParent.postMessage( + {action: 'uwui-hidden', opacity: false}, + origin + ); }, 500 ); @@ -134,6 +141,7 @@ export default { { action: 'uwui-clickable', clickable: isClickable, + opacity: isClickable || this.contextMenuActive || this.uwTriggerZoneVisible, hoverStats: { isOverTriggerZone: isOverTriggerZone, isOverMenuTrigger: isOverMenuTrigger, diff --git a/src/ext/lib/uwui/UI.js b/src/ext/lib/uwui/UI.js index a9b41cc..6f5c9a6 100644 --- a/src/ext/lib/uwui/UI.js +++ b/src/ext/lib/uwui/UI.js @@ -95,6 +95,7 @@ class UI { iframe.style.zIndex = this.isGlobal ? '90009' : '90000'; iframe.style.border = 0; iframe.style.pointerEvents = 'none'; + iframe.style.opacity = 0; iframe.style.backgroundColor = 'transparent !important'; /* 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.display = event.data.opacity ? '100' : '0'; + this.uiIframe.style.opacity = event.data.opacity ? '100' : '0'; break; case 'uw-bus-tunnel': const busCommand = event.data.payload; @@ -335,6 +336,9 @@ class UI { case 'uwui-interface-ready': this.setUiVisibility(!this.isGlobal); break; + case 'uwui-hidden': + this.uiIframe.style.opacity = event.data.opacity ? '100' : '0'; + break; case 'uwui-global-window-hidden': if (!this.isGlobal) { return; // This shouldn't even happen in non-global windows