From 2cc247f929dd408a69e434bd08ee8653f5d57dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 9 Dec 2019 21:03:19 +0100 Subject: [PATCH] add fullscreen button --- script.js | 12 +++++++++++- style.css | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 3f5d070..e3e67a6 100644 --- a/script.js +++ b/script.js @@ -661,8 +661,9 @@ class Board { this.buttons.optFancy = this.addButton(x0, cfgy0, 'Effects:', 'config'); this.buttons.optBlockedEffect = this.addButton(x0, cfgy0+ysp2, 'Dim Blocked:', 'config'); this.buttons.optSloppy = this.addButton(x0, cfgy0+ysp2*2, 'Sloppy Mode:', 'config'); + this.buttons.toggleFullscreen = this.addButton(x0, cfgy0+ysp2*-1.5, 'Fullscreen', 'config'); - this.buttons.btnAbout = this.addButton(x0, cfgy0+ysp2*-1.5, 'Help', 'config'); + this.buttons.btnAbout = this.addButton(x0, cfgy0+ysp2*-2.5, 'Help', 'config'); } updateSettingsGUI(cfg) { @@ -1646,6 +1647,15 @@ class Game { allowTemplateAugmenting: !this.cfg.allowTemplateAugmenting, }) }); + + this.board.buttons.toggleFullscreen.addEventListener('click', () => { + this.info("Toggle Fullscreen"); + if (document.fullscreenElement) { + document.exitFullscreen(); + } else { + this.board.$svg.requestFullscreen(); + } + }); } /** diff --git a/style.css b/style.css index 7f3962f..81a6655 100644 --- a/style.css +++ b/style.css @@ -16,6 +16,7 @@ html, body { #board { height: 100%; width: 100%; + background: #201717; } .disabled .orb {