Refactor Game Bar actions

This commit is contained in:
redphx
2024-10-13 19:15:29 +07:00
parent f2bc98229f
commit 6d2e04aff1
8 changed files with 90 additions and 84 deletions

View File

@@ -11,21 +11,16 @@ export class SpeakerAction extends BaseGameBarAction {
constructor() {
super();
const onClick = (e: Event) => {
BxEvent.dispatch(window, BxEvent.GAME_BAR_ACTION_ACTIVATED);
SoundShortcut.muteUnmute();
};
const $btnEnable = createButton({
style: ButtonStyle.GHOST,
icon: BxIcon.AUDIO,
onClick: onClick,
onClick: this.onClick.bind(this),
});
const $btnMuted = createButton({
style: ButtonStyle.GHOST,
icon: BxIcon.SPEAKER_MUTED,
onClick: onClick,
onClick: this.onClick.bind(this),
classes: ['bx-activated'],
});
@@ -44,6 +39,11 @@ export class SpeakerAction extends BaseGameBarAction {
});
}
onClick(e: Event) {
super.onClick(e);
SoundShortcut.muteUnmute();
}
render(): HTMLElement {
return this.$content;
}