mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-01 10:56:42 +02:00
Add shortcuts to control stream's volume
This commit is contained in:
@@ -36,6 +36,7 @@ export enum BxEvent {
|
||||
MICROPHONE_STATE_CHANGED = 'bx-microphone-state-changed',
|
||||
|
||||
CAPTURE_SCREENSHOT = 'bx-capture-screenshot',
|
||||
GAINNODE_VOLUME_CHANGED = 'bx-gainnode-volume-changed',
|
||||
}
|
||||
|
||||
export enum XcloudEvent {
|
||||
|
@@ -753,11 +753,13 @@ export class Preferences {
|
||||
return this.#prefs[key];
|
||||
}
|
||||
|
||||
set(key: PrefKey, value: any) {
|
||||
set(key: PrefKey, value: any): any {
|
||||
value = this.#validateValue(key, value);
|
||||
|
||||
this.#prefs[key] = value;
|
||||
this.#updateStorage();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
#updateStorage() {
|
||||
|
@@ -183,7 +183,7 @@ export class SettingElement {
|
||||
$range.addEventListener('input', e => {
|
||||
value = parseInt((e.target as HTMLInputElement).value);
|
||||
$text.textContent = renderTextValue(value);
|
||||
onChange && onChange(e, value);
|
||||
!(e as any).ignoreOnChange && onChange && onChange(e, value);
|
||||
});
|
||||
$wrapper.appendChild($range);
|
||||
|
||||
|
@@ -15,7 +15,7 @@ export class Toast {
|
||||
static #timeout?: number | null;
|
||||
static #DURATION = 3000;
|
||||
|
||||
static show(msg: string, status?: string, options: Partial<ToastOptions>={}) {
|
||||
static show(msg: string, status?: string, options: Partial<ToastOptions> = {}) {
|
||||
options = options || {};
|
||||
|
||||
const args = Array.from(arguments) as [string, string, ToastOptions];
|
||||
@@ -43,7 +43,7 @@ export class Toast {
|
||||
// Get values from item
|
||||
const [msg, status, options] = Toast.#stack.shift()!;
|
||||
|
||||
if (options.html) {
|
||||
if (options && options.html) {
|
||||
Toast.#$msg.innerHTML = msg;
|
||||
} else {
|
||||
Toast.#$msg.textContent = msg;
|
||||
|
@@ -77,3 +77,16 @@ export function renderString(str: string, obj: any){
|
||||
return match;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function ceilToNearest(value: number, interval: number): number {
|
||||
return Math.ceil(value / interval) * interval;
|
||||
}
|
||||
|
||||
export function floorToNearest(value: number, interval: number): number {
|
||||
return Math.floor(value / interval) * interval;
|
||||
}
|
||||
|
||||
export function roundToNearest(value: number, interval: number): number {
|
||||
return Math.round(value / interval) * interval;
|
||||
}
|
||||
|
Reference in New Issue
Block a user