Add a Disable button in the MKB dialog

This commit is contained in:
redphx 2024-05-30 17:22:06 +07:00
parent e21375821d
commit 5e43915ff7
3 changed files with 46 additions and 22 deletions

View File

@ -74,7 +74,7 @@
height: var(--bx-button-height);
line-height: var(--bx-button-height);
vertical-align: middle;
vertical-align: -webkit-baseline-middle;
/* vertical-align: -webkit-baseline-middle; */
color: #fff;
overflow: hidden;
white-space: nowrap;

View File

@ -16,7 +16,6 @@
}
.bx-mkb-pointer-lock-msg {
display: flex;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
@ -41,16 +40,7 @@
background: #151515;
}
button {
margin-right: 12px;
height: 60px;
}
svg {
width: 32px;
}
div {
> div:first-of-type {
display: flex;
flex-direction: column;
text-align: left;
@ -69,6 +59,26 @@
font-style: italic;
}
}
> div:last-of-type {
display: flex;
flex-flow: row;
margin-top: 10px;
button {
flex: 1;
&:first-of-type {
margin-right: 5px;
}
&:last-of-type {
margin-left: 5px;
}
}
button
}
}
.bx-mkb-preset-tools {

View File

@ -464,20 +464,34 @@ export class MkbHandler {
window.addEventListener('keydown', this.#onKeyboardEvent);
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
createButton({
icon: BxIcon.MOUSE_SETTINGS,
style: ButtonStyle.PRIMARY,
onClick: e => {
e.preventDefault();
e.stopPropagation();
showStreamSettings('mkb');
},
}),
CE('div', {},
CE('p', {}, t('mkb-click-to-activate')),
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
),
CE('div', {},
createButton({
icon: BxIcon.MOUSE_SETTINGS,
label: t('edit'),
style: ButtonStyle.PRIMARY,
onClick: e => {
e.preventDefault();
e.stopPropagation();
showStreamSettings('mkb');
},
}),
createButton({
label: t('disable'),
onClick: e => {
e.preventDefault();
e.stopPropagation();
this.toggle();
},
}),
),
);
this.#$message.addEventListener('click', this.start.bind(this));