mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-05 20:58:27 +02:00
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { BxIcon } from "@utils/bx-icon";
|
|
import { createButton, ButtonStyle, CE } from "@utils/html";
|
|
import { BaseGameBarAction } from "./action-base";
|
|
import { RendererShortcut } from "../shortcuts/shortcut-renderer";
|
|
|
|
|
|
export class RendererAction extends BaseGameBarAction {
|
|
$content: HTMLElement;
|
|
|
|
constructor() {
|
|
super();
|
|
|
|
const $btnDefault = createButton({
|
|
style: ButtonStyle.GHOST,
|
|
icon: BxIcon.EYE,
|
|
onClick: this.onClick.bind(this),
|
|
});
|
|
|
|
const $btnActivated = createButton({
|
|
style: ButtonStyle.GHOST,
|
|
icon: BxIcon.EYE_SLASH,
|
|
onClick: this.onClick.bind(this),
|
|
classes: ['bx-activated'],
|
|
});
|
|
|
|
this.$content = CE('div', {}, $btnDefault, $btnActivated);
|
|
}
|
|
|
|
onClick(e: Event) {
|
|
super.onClick(e);
|
|
const isVisible = RendererShortcut.toggleVisibility();
|
|
this.$content.dataset.activated = (!isVisible).toString();
|
|
}
|
|
|
|
reset(): void {
|
|
this.$content.dataset.activated = 'false';
|
|
}
|
|
}
|