From 7a38d009d9c422d6a40cf310abb8ce49873db206 Mon Sep 17 00:00:00 2001 From: jacks0n Date: Fri, 4 Apr 2025 01:01:50 +0200 Subject: [PATCH] Hide wrongly displayed "Hide" button on main page (#403) ## Description: A previous commit made the "Hide" button of the event log visible on the main page. This hides it again, as before. ![image](https://github.com/user-attachments/assets/83e7dbe8-9af7-4719-8c74-f89076345a4a) ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: jacks0n --- src/client/graphics/layers/EventsDisplay.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/graphics/layers/EventsDisplay.ts b/src/client/graphics/layers/EventsDisplay.ts index 738d39e62..58ca874e0 100644 --- a/src/client/graphics/layers/EventsDisplay.ts +++ b/src/client/graphics/layers/EventsDisplay.ts @@ -58,6 +58,7 @@ export class EventsDisplay extends LitElement implements Layer { public game: GameView; public clientID: ClientID; + private active: boolean = false; private events: Event[] = []; @state() private incomingAttacks: AttackUpdate[] = []; @state() private outgoingAttacks: AttackUpdate[] = []; @@ -97,6 +98,7 @@ export class EventsDisplay extends LitElement implements Layer { init() {} tick() { + this.active = true; const updates = this.game.updatesSinceLastTick(); for (const [ut, fn] of this.updateMap) { updates[ut]?.forEach((u) => fn(u)); @@ -531,6 +533,10 @@ export class EventsDisplay extends LitElement implements Layer { } render() { + if (!this.active) { + return html``; + } + this.events.sort((a, b) => { const aPrior = a.priority ?? 100000; const bPrior = b.priority ?? 100000;