diff --git a/src/client/hud/layers/EventsDisplay.ts b/src/client/hud/layers/EventsDisplay.ts index f9961e4b3..0322d8403 100644 --- a/src/client/hud/layers/EventsDisplay.ts +++ b/src/client/hud/layers/EventsDisplay.ts @@ -74,11 +74,19 @@ export class EventsDisplay extends LitElement implements Controller { private _eventsContainer?: HTMLDivElement; private _shouldScrollToBottom = true; + @query(".important-events-container") + private _importantEventsContainer?: HTMLDivElement; + private _shouldScrollImportantToBottom = true; + updated(changed: Map) { super.updated(changed); if (this._eventsContainer && this._shouldScrollToBottom) { this._eventsContainer.scrollTop = this._eventsContainer.scrollHeight; } + if (this._importantEventsContainer && this._shouldScrollImportantToBottom) { + this._importantEventsContainer.scrollTop = + this._importantEventsContainer.scrollHeight; + } } private renderButton(options: { @@ -172,6 +180,14 @@ export class EventsDisplay extends LitElement implements Controller { this._shouldScrollToBottom = true; } + if (this._importantEventsContainer) { + const el = this._importantEventsContainer; + this._shouldScrollImportantToBottom = + el.scrollHeight - el.scrollTop - el.clientHeight < 5; + } else { + this._shouldScrollImportantToBottom = true; + } + if (!this._isVisible && !this.game.inSpawnPhase()) { this._isVisible = true; this.requestUpdate(); @@ -640,7 +656,7 @@ export class EventsDisplay extends LitElement implements Controller { ${tier1Events.length > 0 || showBetrayalTimer ? html`