From 3ed3aca00130d5227933b03a0c004142f42ffada Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 15 Jan 2025 23:38:02 +0100 Subject: [PATCH] add new function, but don't use it just yet --- src/ext/lib/uwui/UI.js | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/ext/lib/uwui/UI.js b/src/ext/lib/uwui/UI.js index 7714e7b..d7b25c2 100644 --- a/src/ext/lib/uwui/UI.js +++ b/src/ext/lib/uwui/UI.js @@ -211,6 +211,65 @@ class UI { this.handleMessage(message); } + + /** + * Generates marker positions for bug mitigations + */ + generateDebugMarker(x, y) { + const [parentMainDimension, parentCrossDimension] = y === 'center' ? ['height', 'width'] : ['width', 'height']; + + let anchorStyle; + + if (x === 'center' && x === y) { + anchorStyle = 'left: 50%; top: 50%; transform: translate(-50%, -50%);'; + } else { + switch (x) { + case 'left': + anchorStyle = 'left: 0px;'; + break; + case 'center': + anchorStyle = 'left: 50%; transform: translateX(-50%);'; + break; + case 'right': + anchorStyle = 'right: 0px;'; + break; + } + switch (y) { + case 'top': + anchorStyle = `${anchorStyle} top: 0px;`; + break; + case 'center': + anchorStyle = `${anchorStyle} top: 50%; transform: translateY(-50%);`; + break; + case 'bottom': + anchorStyle = `${anchorStyle} bottom: 0px;`; + break; + } + } + + + let [mainAxis, crossAxis] = y === 'center' ? ['left', 'top'] : ['top', 'left']; + + const template = document.createElement('template'); + template.innerHTML = ` +
+
+
+
+
+
+
+
+ This marker is Chrome Shitiness Mitigation mechanism for Ultrawidify. It turns out that as of 2025-01, Chrome does not correctly respect + allowTransparency property on certain iframes, and will force white or black background across the entire element. It is unclear what's + causing the issue — so far, it seems to appear randomly. +
+
+ `; + + return template.content.firstChild; + } + setUiVisibility(visible) { if (visible) { this.element.style.width = '100%';