mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Fix the StreamHud buttons being wonky
This commit is contained in:
parent
e8de67c817
commit
4c601234ef
@ -6951,7 +6951,7 @@ function addCss() {
|
|||||||
/* Fix Stream menu buttons not hiding */
|
/* Fix Stream menu buttons not hiding */
|
||||||
div[class^=HUDButton-module__hiddenContainer] ~ div:not([class^=HUDButton-module__hiddenContainer]) {
|
div[class^=HUDButton-module__hiddenContainer] ~ div:not([class^=HUDButton-module__hiddenContainer]) {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
@ -9043,6 +9043,33 @@ function watchHeader() {
|
|||||||
|
|
||||||
function cloneStreamHudButton($orgButton, label, svg_icon) {
|
function cloneStreamHudButton($orgButton, label, svg_icon) {
|
||||||
const $container = $orgButton.cloneNode(true);
|
const $container = $orgButton.cloneNode(true);
|
||||||
|
let timeout;
|
||||||
|
|
||||||
|
const onTransitionStart = e => {
|
||||||
|
if ( e.propertyName !== 'opacity') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout && clearTimeout(timeout);
|
||||||
|
$container.style.pointerEvents = 'none';
|
||||||
|
};
|
||||||
|
|
||||||
|
const onTransitionEnd = e => {
|
||||||
|
if ( e.propertyName !== 'opacity') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const left = document.getElementById('StreamHud').style.left;
|
||||||
|
if (left === '0px') {
|
||||||
|
timeout && clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
$container.style.pointerEvents = 'auto';
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$container.addEventListener('transitionstart', onTransitionStart);
|
||||||
|
$container.addEventListener('transitionend', onTransitionEnd);
|
||||||
|
|
||||||
const $button = $container.querySelector('button');
|
const $button = $container.querySelector('button');
|
||||||
$button.setAttribute('title', label);
|
$button.setAttribute('title', label);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user