From 2ff990cb4dcf8cb5eebc3c3a614db16693dd2381 Mon Sep 17 00:00:00 2001 From: aliraza556 Date: Sun, 11 Aug 2024 21:29:47 +0500 Subject: [PATCH] fullscreen mode tweaks --- src/ui/fullscreen.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ui/fullscreen.ts b/src/ui/fullscreen.ts index 0c4eb27ec..6adf3da36 100644 --- a/src/ui/fullscreen.ts +++ b/src/ui/fullscreen.ts @@ -6,6 +6,8 @@ export class Fullscreen { if (isFullscreen) { button.classList.add('fullscreenMode'); } + + this.button.addEventListener('click', () => this.toggle()); } toggle() { @@ -23,8 +25,22 @@ export class Fullscreen { .querySelectorAll('.fullscreen__title') .forEach((el) => (el.textContent = 'Contract')); document.getElementById('AncientBeast').requestFullscreen(); + this.simulateF11KeyPress(); } } + + private simulateF11KeyPress() { + const evt = new KeyboardEvent('keydown', { + key: 'F11', + code: 'F11', + keyCode: 122, + which: 122, + bubbles: true, + cancelable: true, + }); + + document.dispatchEvent(evt); + } } /**